I'm trying to hide a form label and textbox, by default, and make them appear when an option is selected. I can't see why my code keeps failing.
<tr>
<td><label>My Label</label></td>
<td>
<select name="1" id="1">
<option value="2" selected="selected">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="Other">Other</option>
</select>
</td>
<td><label class=".otherHide">Other</label></td>
<td><input class=".otherHide" type="text" name="otherSpec" id="otherSpec" /></td>
</tr>
jQuery(document).ready(function()
{
jQuery('#1').change(function()
{
jQuery('#1 option:selected').each(function()
{
if (jQuery(this).text() == 'Other')
{
jQuery('.otherHide').each(function()
{
jQuery(this).animate({opacity: 0.0}, 2000);
});
}
});
}).change();
});
It's currently set to hide the form elements why I was testing.
I originally wasn't using classes and tried my hand at traversing through it. Failing at that, I resorted to classes and ended up failing.
Why isn't jQuery selecting my elements? >.<