javascript - onChange event---> only alert working?!! other functions not working -


<div class="col-md-2"><select id="ddluser" onchange="loadcheckboxesforuser()"   class="form-control" style="width:100%;" >    function loadcheckboxesforuser() {      alert("hi");     $("#checkbox1").attr("checked", "checked"); } 

only alert working, not make checkbox checked,

otherwise when use function on $(document).ready , works fine

you can use .prop method check checkbox

$("#checkbox1").prop("checked", "checked"); 

Comments

Popular posts from this blog

iis - ASP.Net Core CreatedAtAction in HttpPost action returns 201 but entire request ends with 500 -

ssh - Vagrant Windows - ssh_exchange_identification: read: Connection reset by peer -

gcc - Neither ld wrap nor LD_PRELOAD working to intercept system call -