0
$(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

4
  • 1
    post your html too please Commented Aug 12, 2015 at 14:01
  • Did you hook the click event to the function cbclicked? Commented Aug 12, 2015 at 14:03
  • "How do you add html to this? Im new to stackoverflow' Commented Aug 12, 2015 at 14:06
  • @AaronMoore well first of all stop putting quote marks in your comments, it looks weird... you can click edit under the tags on your question and simply stick in your html and click save Commented Aug 12, 2015 at 14:08

2 Answers 2

2

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();
    }
});
});
Sign up to request clarification or add additional context in comments.

Comments

0

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();
        }
    });

});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.