jquery - Select Menu onChange DIV element with Javascript -


I want to display the english1 div if 'english' is selected and & amp; If French is selected then French div.

How do I get it using Javascript?

  & lt; Form method = "get" action = "/" & gt; & Lt; Fieldset & gt; & Lt; Select name = 'cat' id = 'cat' class = 'postform' & gt; & Lt; Option value = '0' selected = 'selected' & gt; Select one & amp; # 8230; & Lt; / Options & gt; & Lt; Option class = "level-0" value = "english1" & gt; English & lt; / Option & gt; & Lt; Option class = "level-0" value = "french1" & gt; French & lt; / Option & gt; & Lt; / Select & gt; & Lt; Script type = "text / javascript" & gt; & Lt ;! - var dropdown = document.getElementById ("cat"); Cat change on function (if (dropdown.options [dropdown.selectedIndex] .value! = '0') {location.href = "http: // localhost: 8888 / mysite /? Language =" + dropdown.options [ drop down. SelectedIndex .Value]; }} Dropdown.onchange = onCatChange; - & gt; & Lt; / Script & gt; & Lt; / Fieldset & gt; & Lt; / Form & gt; & Lt; Div class = "english1" & gt; English & lt; / Div & gt; & Lt; Div class = "french1" & gt; French & lt; / Div & gt;  

Many thanks: -)

You can use this snippet Can be: $ ('.' $ '' ('# Cat'). (Function () {$ ('form'), siblings ('div'). ('#cat'). Val () . Show ();});


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -