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

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -