Hi all I have the following dropdown:
<div id='drop'>
<select name='option'>
<option value="Opt1">Opt1</option>
<option value="Opt2">Opt2</option>
<option value="Opt3">Opt3</option>
</select>
</div>
<div id = 'NewContent'>
//I need different content here depending on selection
<div id="form1" style="display:none">Content of Form1</div>
<div id="form2"style="display:none">Content of Form2</div>
<div id="form3"style="display:none">Content of Form3</div>
</div>
I then have the following Javascript:
$('select[name="option"]').change(function() {
$('#NewContent').find('*').hide();
$('#'+$(this).val()).show();
});
this will work and display: Content of Form 1, 2 etc. when the user changes the dropdown.
However - the issue is, If I were to simply change one of the divs to include another - nothing displays on the screen, EG.:
<div id = 'NewContent'>
//I need different content here depending on selection
<div id="form1" style="display:none"><div>Content of Form1</div></div> //this won't show anything
<div id="form2"style="display:none">Content of Form2</div>
<div id="form3"style="display:none">Content of Form3</div>
</div>
is there a way to get around this issue??