html - JavaScript Code Not Working -


My Java script code is not working, currently when you select a value in the first drop down menu, the second drop Down menu is editable which is fine but I want to do it like when you select the 'default' option in the first drop down menu, the second drop down menu changes to 'default' and becomes disabled Goes to read only, Ekin if I have another option I choose the other 'default' second menu should be editable.

  & lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" & gt; Function mySecondFunction () {var ddl = document.getElementById ("1"); Var selectedValue = ddl.options [ddl.selectedIndex] .value; If (selected value == "default") {document.getElementById ("mySelection"). Disabled = true; } And {document.getElementById ("mySelection"). Disabled = false; }} & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Select ID = "1" onchange = "mySecondFunction ()" & gt; & Lt; Option value = "OptionZero" & gt; Default & lt; / Options & gt; & Lt; Option value = "option on" & gt; Car & lt; / Options & gt; & Lt; Option value = "option two" & gt; Car 2 & lt; / Options & gt; & Lt; Option value = "option" "car 23  gt; & select; gt; & lt; br & gt; disabled id =" mys select "& gt; select & lt; Option value = "OptionZero"> Default  gt; Option value = "OptionOn">   C & lt; / option & gt; & lt; / select & gt; & lt; / body & gt; & Lt  

Should be written if (selectedValue == "OptionZero") {

This value is attribute which is an L Sets the value on the element.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -