I have an HTML element:
<a style='text-decoration:none;' id='$innerdata[0]' class='cat' href='#'> <input type='checkbox' name='vehicle' value='Bike'> $innerdata[1]</a>
I am trying to get the value of checkbox, but alert()
is printing undefined.
$('body').on('click', '.cat', function()
{
$topcat = $(this);
alert ($topcat.closest().find('[type=checkbox]').val());
}
How do I get the value of the checkbox?