I have a web form where I need to have an additional field displayed on the screen if a certain option is selected in a drop down list. I have followed several Javascript tutorials online and none have worked so far. Here is one of the things I already tried:
<script type="text/javascript">
function setup(ans) {
lit = ''
if (ans == 'manual') {
lit = 'Manual Selected'
lit = lit + '<tr>'
lit = lit + '<th align="right" class="body-text">Add New Group</th>'
lit = lit + '<td class="body-text"><input type="text" name="groupadd">'
lit = lit + '</td> </tr>'
}
document.getElementById('rep').innerHTML=lit
}
</script>
It doesn’t work. What else can I try?
I have also seen “http://stackoverflow.com/questions/7353403/javascript-hide-a-form-input-depending-on-the-value-of-a-particular-drop-down” but it does not work for me either.
Thanks!
And this is what I want to add:
<tr>
<th align="right" class="body-text">Add New Group</th>
<td class="body-text"><input type="text" name="groupadd"></td>
</tr>
Try this.