Re: [jQuery] best show/hide div code?

2006-10-18 Thread Rey Bango




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
	tdinput 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 eventbr
class="smaller"for event announcement only/td
	tdinput 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/


Re: [jQuery] best show/hide div code?

2006-10-18 Thread Karl Swedberg
On Oct 18, 2006, at 2:09 PM, Rey Bango wrote:I initially tried the toggle() method but it didn't provide the correct functionality for this specific issue.That's right; it doesn't provide functionality for onchange. .toggle() is for click only. From the API:"Toggle between two function calls every other click. Whenever a matched element is clicked, the first specified function is fired, when clicked again, the second is fired. All subsequent clicks continue to rotate through the two functions."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();
	})		
});


	Zip Code of event
	

___Karl Swedbergwww.englishrules.comwww.learningjquery.com___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] best show/hide div code?

2006-10-17 Thread Andy Matthews
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=rightMailing Type/td
td
select name=type
option value=generalGeneral Announcement/option
option value=storeBCC Store Announcement/option
option value=ckcClowndergarten Announcement/option
option value=eventEvent Announcement/option
/select
/td
/tr
tr class=formBG
td class=formlabel align=rightZip Code of eventbri
class=smallerfor event announcement only/i/td
tdinput 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/


Re: [jQuery] best show/hide div code?

2006-10-17 Thread Rey Bango
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=rightZip Code of event/td
tdinput 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=rightMailing Type/td
   td
   select name=type
   option value=generalGeneral Announcement/option
   option value=storeBCC Store Announcement/option
   option value=ckcClowndergarten Announcement/option
   option value=eventEvent Announcement/option
   /select
   /td
 /tr
 tr class=formBG
   td class=formlabel align=rightZip Code of eventbri
 class=smallerfor event announcement only/i/td
   tdinput 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/


Re: [jQuery] best show/hide div code?

2006-10-17 Thread Andy Matthews
Anyone have an idea on this one? I've tried a few things, but I'm not sure
how to reference a specific value in a select control.

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

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Andy Matthews
Sent: Tuesday, October 17, 2006 10:39 AM
To: [jQuery]
Subject: [jQuery] best show/hide div code?


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=rightMailing Type/td
td
select name=type
option value=generalGeneral Announcement/option
option value=storeBCC Store Announcement/option
option value=ckcClowndergarten Announcement/option
option value=eventEvent Announcement/option
/select
/td
/tr
tr class=formBG
td class=formlabel align=rightZip Code of eventbri
class=smallerfor event announcement only/i/td
tdinput 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/


Re: [jQuery] best show/hide div code?

2006-10-17 Thread Mike Chabot
Some examples:
selectField.options[selectField.selectedIndex].value
or
selectField.options[selectField.selectedIndex].text
or
selectField.options[3].selected

Enjoy,
Mike Chabot

On 10/17/06, Andy Matthews [EMAIL PROTECTED] wrote:
 Anyone have an idea on this one? I've tried a few things, but I'm not sure
 how to reference a specific value in a select control.

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

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Behalf Of Andy Matthews
 Sent: Tuesday, October 17, 2006 10:39 AM
 To: [jQuery]
 Subject: [jQuery] best show/hide div code?


 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=rightMailing Type/td
td
select name=type
option value=generalGeneral Announcement/option
option value=storeBCC Store Announcement/option
option value=ckcClowndergarten 
 Announcement/option
option value=eventEvent Announcement/option
/select
/td
 /tr
 tr class=formBG
td class=formlabel align=rightZip Code of eventbri
 class=smallerfor event announcement only/i/td
tdinput 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/