how to run click function after default behaviour of a element
- by Somebody is in trouble
My code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="jquery.js"></script>
<script>
$(function(){
$("body").on("click",".mes_sel",function(){
if($(".mes_sel:checked").length==0){
alert("Checked");
}
else alert("Not Checked");
});
});
</script></head>
<body>
<input type="checkbox" class="mes_sel">
</body>
</html>
It is alerting checked when the textbox is unchecked because onclick is running before the checking of checkbox.How can i make the click event to run after checking/unchecking of the input