I initially tried the toggle() method but it didn't provide the correct functionality for this specific issue.

stylo~ wrote:
This seems so common, is there no toggle function?

Btw, what is the best way to add little helpers like that to our own jquery?


Rey Bango-2 wrote:
  
Hey Andy, you can do something like this:

$(document).ready(function() {
	
	$( "#type" ).change( function() {
		if ( $( this ).val() == "event" )
			$("#zipCode").show();
		else
			$("#zipCode").hide();
	})		
});

<tr id="zipCode">
	<td align="right">Zip Code of event</td>
	<td><input type="text" name="zip" id="zipfield"></td>
</tr>
</table>


Andy Matthews wrote:
    
I'm working on a mailing list manager and one of the options is to
provide a
zip code for emailing anyone in that area. I'd like to hide this field
unless the user has selected the "Tour Date" option from a select field.

The relevant code is below. The second TR (and it's contents) will be
hidden
by default using CSS, but I want to toggle it's display property when the
user selects or deselects the "event" option in the "type" dropdown
field.

<table>
<tr class="formBG">
	<td class="formlabel" align="right">Mailing Type</td>
	<td>
		<select name="type">
			<option value="general">General Announcement</option>
			<option value="store">BCC Store Announcement</option>
			<option value="ckc">Clowndergarten Announcement</option>
			<option value="event">Event Announcement</option>
		</select>
	</td>
</tr>
<tr class="formBG">
	<td class="formlabel" align="right">Zip Code of event<br>
class="smaller">for event announcement only</td>
	<td><input type="text" name="zip" id="zipfield" class="zcinput"></td>
</tr>
</table>

How would I do this with jQuery?

<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

      
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


    

  
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to