mercredi 28 octobre 2015

jQuery Checkbox Not Refreshing On Page Load

Using jQuery 1.9, I'm writing a WebForm that retrieves data on page load an alters WebFields based on results. One of the fields is a checkbox.

<input id="chkFollowUp" type="checkbox" class="form-control"/>

I am trying to change the value on page load. The back end says the value has been altered, but the UI remains unchecked.

<script type="text/javascript">
    $(document).ready(function () {
        alert($('#chkFollowUp').prop('checked'));    // return false
        $('#chkFollowUp').prop('checked', true);
        alert($('#chkFollowUp').prop('checked'));    // return true, but UI unchanged
    })
</script>

Do I need to refresh the UI to display the new value? Any guidance would be appreciated. Thank you.




Aucun commentaire:

Enregistrer un commentaire