.click() event of checkbox control not triggered after page re-load and after model state error
I have a MVC 4.0 mobile application. On the login page, we have a checkbox whose .click() event, I am trapping in a Javascript as below:
<script type="text/javascript">
$(document).ready(function () {
alert("Ready");
$("#checkkBoxId").click(function () {
alert("Clicked");
});
});
</script>
The checkbox has been created as follows:
<div><input type="checkbox" id="checkkBoxId" /></div>
<label for="checkkBoxId">Mask</label>
When the page is rendered, I get the "Ready" alert and when the checkbox is clicked, "Clicked" alert is displayed.
However, if the page is refreshed or a model state error occurs(e.g. login validation failure), the "Ready" alert is displayed however the "Clicked" is never shown from that point on.