I’m trying to check if the li element that is clicked has the ‘update’ class.
$('li.category').live('click', function(event)
{
//my code here
});
I tried:
if (($(event.target).hasClass('update')))
if ($(this).hasClass('update'))
which both always return false.
How can I do this?
if ($(this).hasClass('update'))should work just fine. Are you sure the element you are testing has theupdateclass? Here’s an example:http://jsfiddle.net/yv3ba/