Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved] Hide element once option is selected in list

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #150696
    matthisco
    Participant

    Hello,

    I’m trying to hide my dropdown list upon the selected value of a list before:

    A t the moment nothing happens, can anyone please help?

    $("#your_relationship").bind("change", function() {
    if ($(this).val() == "4") {
        $("#your_school").prop( "disabled", true );
    

    alert(“input hidden”); }

    });

    #150697
    Paulie_D
    Member

    Isn’t ‘disabled’ an attribute and not a property?

    I dunno…my JS fu (foo?) is bad.

    Not sure if it will hide it or just ‘grey it out’ though.

    Once it is has the disabled attribute/property, you could hide it with

    option:disabled {
    display:none;
    }
    
    #150956
    matthisco
    Participant

    Many thanks for your replies.

    The link above is exactly what I needed

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.