[jQuery] Re: Hide/Show when Check Box is selected
Hey! Is there any simple way to rewrite that so it works on ID:s instead on class? I have several checkboxes/hidden divs, but I only want to unhide the div that belongs to the clicked checkbox. Best regards. On Feb 18, 5:10 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Miguel, you can use the click trigger of the checkbox: form show secret: input id=checkbox type=checkbox/ div id=div secret field: input type=text / /div /from $(#div).hide(); $(#checkbox).click(function(){ if ( this.checked ) { $(#div).show(); } else { $(#div).hide(); } }) by(e) Stephan 2009/2/18 shapper mdmo...@gmail.com: Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel
[jQuery] Re: Hide/Show when Check Box is selected
Hi the example is working on IDs (see the # in the selector). If you send a HTML snippet of your page, maybe I better understand what you mean. by(e) Stephan 2009/2/26 nubcake unniw...@gmail.com: Hey! Is there any simple way to rewrite that so it works on ID:s instead on class? I have several checkboxes/hidden divs, but I only want to unhide the div that belongs to the clicked checkbox. Best regards. On Feb 18, 5:10 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Miguel, you can use the click trigger of the checkbox: form show secret: input id=checkbox type=checkbox/ div id=div secret field: input type=text / /div /from $(#div).hide(); $(#checkbox).click(function(){ if ( this.checked ) { $(#div).show(); } else { $(#div).hide(); } }) by(e) Stephan 2009/2/18 shapper mdmo...@gmail.com: Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel
[jQuery] Re: Hide/Show when Check Box is selected
Hello again! div class=container h1GENERAL/h1 div class=left input type=checkbox name=application[] value=101a class=tooltip href=#App #1spanInfo/span/abr div id=div101[SECRET FIELD FOR App #1]/div input type=checkbox name=application[] value=100a class=tooltip href=#App #2spanInfo/span/abr div id=div100[SECRET FIELD FOR App #2]/div . /div /div I'd like to have it so when I click the checkbox for App #1 only the secret field for App #1 becomes visable. Thanks for your help! Best regards On Feb 26, 2:18 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi the example is working on IDs (see the # in the selector). If you send a HTML snippet of your page, maybe I better understand what you mean. by(e) Stephan 2009/2/26 nubcake unniw...@gmail.com: Hey! Is there any simple way to rewrite that so it works on ID:s instead on class? I have several checkboxes/hidden divs, but I only want to unhide the div that belongs to the clicked checkbox. Best regards. On Feb 18, 5:10 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Miguel, you can use the click trigger of the checkbox: form show secret: input id=checkbox type=checkbox/ div id=div secret field: input type=text / /div /from $(#div).hide(); $(#checkbox).click(function(){ if ( this.checked ) { $(#div).show(); } else { $(#div).hide(); } }) by(e) Stephan 2009/2/18 shapper mdmo...@gmail.com: Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel
[jQuery] Re: Hide/Show when Check Box is selected
Hi, 1. Hide all your divs. Maybe you could add a distinguishable class to your hidden divs, this would make the selection more readable and precise. $(.left div).hide(); 2. Add a click handler to all your checkboxes. Get the ID from the value attribute and hide / show the according div. $(.left :checkbox).click(function(){ var id = #div+this.value; if ( this.checked ) $(id).show(); else $(id).hide(); }); by(e) Stephan 2009/2/26 nubcake unniw...@gmail.com: Hello again! div class=container h1GENERAL/h1 div class=left input type=checkbox name=application[] value=101a class=tooltip href=#App #1spanInfo/span/abr div id=div101[SECRET FIELD FOR App #1]/div input type=checkbox name=application[] value=100a class=tooltip href=#App #2spanInfo/span/abr div id=div100[SECRET FIELD FOR App #2]/div . /div /div I'd like to have it so when I click the checkbox for App #1 only the secret field for App #1 becomes visable. Thanks for your help! Best regards On Feb 26, 2:18 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi the example is working on IDs (see the # in the selector). If you send a HTML snippet of your page, maybe I better understand what you mean. by(e) Stephan 2009/2/26 nubcake unniw...@gmail.com: Hey! Is there any simple way to rewrite that so it works on ID:s instead on class? I have several checkboxes/hidden divs, but I only want to unhide the div that belongs to the clicked checkbox. Best regards. On Feb 18, 5:10 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Miguel, you can use the click trigger of the checkbox: form show secret: input id=checkbox type=checkbox/ div id=div secret field: input type=text / /div /from $(#div).hide(); $(#checkbox).click(function(){ if ( this.checked ) { $(#div).show(); } else { $(#div).hide(); } }) by(e) Stephan 2009/2/18 shapper mdmo...@gmail.com: Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel
[jQuery] Re: Hide/Show when Check Box is selected
Thank you so much, it works like a charm! Best regards. On Feb 26, 3:01 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, 1. Hide all your divs. Maybe you could add a distinguishable class to your hidden divs, this would make the selection more readable and precise. $(.left div).hide(); 2. Add a click handler to all your checkboxes. Get the ID from the value attribute and hide / show the according div. $(.left :checkbox).click(function(){ var id = #div+this.value; if ( this.checked ) $(id).show(); else $(id).hide(); }); by(e) Stephan 2009/2/26 nubcake unniw...@gmail.com: Hello again! div class=container h1GENERAL/h1 div class=left input type=checkbox name=application[] value=101a class=tooltip href=#App #1spanInfo/span/abr div id=div101[SECRET FIELD FOR App #1]/div input type=checkbox name=application[] value=100a class=tooltip href=#App #2spanInfo/span/abr div id=div100[SECRET FIELD FOR App #2]/div . /div /div I'd like to have it so when I click the checkbox for App #1 only the secret field for App #1 becomes visable. Thanks for your help! Best regards On Feb 26, 2:18 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi the example is working on IDs (see the # in the selector). If you send a HTML snippet of your page, maybe I better understand what you mean. by(e) Stephan 2009/2/26 nubcake unniw...@gmail.com: Hey! Is there any simple way to rewrite that so it works on ID:s instead on class? I have several checkboxes/hidden divs, but I only want to unhide the div that belongs to the clicked checkbox. Best regards. On Feb 18, 5:10 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Miguel, you can use the click trigger of the checkbox: form show secret: input id=checkbox type=checkbox/ div id=div secret field: input type=text / /div /from $(#div).hide(); $(#checkbox).click(function(){ if ( this.checked ) { $(#div).show(); } else { $(#div).hide(); } }) by(e) Stephan 2009/2/18 shapper mdmo...@gmail.com: Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel
[jQuery] Re: Hide/Show when Check Box is selected
Hi Miguel, you can use the click trigger of the checkbox: form show secret: input id=checkbox type=checkbox/ div id=div secret field: input type=text / /div /from $(#div).hide(); $(#checkbox).click(function(){ if ( this.checked ) { $(#div).show(); } else { $(#div).hide(); } }) by(e) Stephan 2009/2/18 shapper mdmo...@gmail.com: Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel