kabucek Posted March 30, 2009 Share Posted March 30, 2009 hello @LL,I have some dropdown<select name='selectedProd'> <option value='code1'>event 1,IL</option> <option value='code2'>event 2, IL</option>I want to create checkbox visible only if user picks event 1 from dropdown, but checkbox would not show up if event 2 will be selected.is that possible?thanks Link to comment Share on other sites More sharing options...
Bloodrun Posted March 31, 2009 Share Posted March 31, 2009 What you could do, is have the checkbox visible at all times, but only able to use when option one has been picked by using a javascript code, such as this:function updatefields(){if (document.getElementById("selectedProd").options[document.getElementById("selectedProd").selectedIndex].value=='code1'){document.getElementById("checkbox").disabled=false;}else{document.getElementById("checkbox").disabled=true;}}<input type="checkbox" name="checkbox" id="checkbox"/>Hoped that helped. Link to comment Share on other sites More sharing options...
jcarle Posted April 14, 2009 Share Posted April 14, 2009 You could also make the checkbox initially hidden :<input id="checkboxNamedID" type="checkbox" style="display: none;">Then in your javascript show it with :document.getElementById('checkboxNamedID').style.display = '';And hide it again with :document.getElementById('checkboxNamedID').style.display = 'none'; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now