it has been impossible to attach a click event on label tags but I can’t see why.
The jQuery lib is at:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"
type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('label').('click', function () {
alert("this is the click on label!");
return false;
});
});
</script>
on my View MVC 2.0 page I have a for to fech a list of countries, to bind a set of checkboxes:
<label><input id='country_<%=country.CountryID%>'
type="checkbox" name="country" value="on"/> <%=country.CountryName %>
</label><br />
When I click on the label nothing happens on IE9, Chrome 12 or Firefox 5.
It looks like you’re trying to bind:
You appear to have left out the
bindmethod name. Alternatively, you can set the click by directly accessing the click method: