Reputation: 1
$(function cbclicked() {
$('#CBAllPlates').hide();
$('#ddlPlate').change(function () {
if ($('#ddlPlate').val() == "Broth") {
$('#CBAllPlates').show();
} else {
$('#CBAllPlates').hide();
}
});
});
Anyone knows why this won't work? All I want is every time any value in the drop down list "ddlPlate" is clicked to hide my checkbox "CBAllPlates". I also have the drop down list & checkbox in variables .Client idk if that is a problem
Upvotes: 0
Views: 1999
Reputation: 1047
your code is right but wrong placed code and check the link here
$(function(){
$(".bookMovieCheck").hide();
$("#movies").change(function(){
if($(this).val() == "bahubali"){
$(".bookMovieCheck").show();
}else{
$(".bookMovieCheck").hide();
}
});
});
Upvotes: 0
Reputation: 5600
see this fiddle here is the code which runs on load
of page :
<select id="ddlPlate">
<option value="">Select</opion>
<option value="Broth">Broth</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="checkbox" id="CBAllPlates"/>
$(function() {
$('#CBAllPlates').hide();
$('#ddlPlate').change(function () {
if ($('#ddlPlate').val() == "Broth") {
$('#CBAllPlates').show();
} else {
$('#CBAllPlates').hide();
}
});
});
Upvotes: 2