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
create checkbox when choice is made from dropdown
Moderator: General Moderators
- novice4eva
- Forum Contributor
- Posts: 327
- Joined: Thu Mar 29, 2007 3:48 am
- Location: Nepal
Re: create checkbox when choice is made from dropdown
yes, very possible.
Code: Select all
<select name='selectedProd' id='selectedProd' onchange="showHide()">
<option value='code1'>event 1,IL</option>
<option value='code2'>event 2, IL</option>
</select>
<script>
function showHide()
{
if(document.getElementById('selectedProd').value=='code1')
document.getElementById('THE ID OF DIV THAT CONTAINS THE CHECKBOX OR THE CHECKBOX ITSELF')).style.display='inline';//OR BLOCK
}
else
document.getElementById('THE ID OF DIV THAT CONTAINS THE CHECKBOX OR THE CHECKBOX ITSELF')).style.display='none';
</script>