I want to make a check box checked automatically (using jquery) when a user select an option from a certain select input element .
Coding :
$("#cboUser").change(function(){
$.ajax({
type: "POST",
url: "sysnuser",
data: "slcbo=slcbo&uid="+ $("#cboUser").val() ,
success: function(html){
$("#divmsg").html('');
}
});
});
<select class="textboxforall" id="cboUser" name="cboUser" >
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="checkbox" id="check1" name="check1" ?>
If you mean you want checkbox to be checked on changing select, then:
$(document).ready(function() { $("#cboUser").change(function(){ var optId = $(this).val(); //check the checkbox $("#check"+optId).attr("checked", "checked"); $.ajax({ type: "POST", url: "sysnuser", data: "slcbo=slcbo&uid="+ $("#cboUser").val() , success: function(html){ $("#divmsg").html(''); } }); }); });Hope it helps