I need an onclick event, when the user clicks on the first li aka(Any Date).How do I select that element using jQuery?
Well it has an id
so you can use that in your selector. You are targeting the link inside the li
correct?
$("#ui-id-2 a").click(function(){
// function goes here
return false; // the link itself has a behaviour associated with it so we want to stop that
});
Otherwise for something more generic you can use the :first-child selector.
Note : While :first matches only a single element, the :first-child selector can match more than one: one for each parent.
$("ul.ui-menu li:first-child a").click(function(){});