Checkbox not working till I refresh

Checkbox not working till I refresh


Hi,

  1. <label><input type="checkbox" id="chkAccept" name="chkAccept">I have reviewed this leave application</label>
and below jquery. I am trying to show / hide buttons when checkbox is checked on unchecked but it's working from the first time I load the page. I have to refresh to get it working.

  1. $(document).on("pagecreate", "#pagePendingReviewLeaveDetails", function(event)
  2. {
  3. $.validator.messages.required = "";

  4. $('#chkAccept').click(function ()
  5. {
  6. $("#btnAccept").toggle(this.checked);
  7. $("#btnDecline").toggle(this.checked);

  8. $('html, body').animate(
  9. {
  10. scrollTop: $(document).height()
  11. },
  12. 1500);
  13. return false;
  14. });
  15. });


Kindly help..


Thanks,