show div on check for checkbox
December 11, 2007
Sometimes you need to show a div when you click a checkbox, here is how yo do it. You need jquery to establish this.
Code (html)
-
Check me
-
-
<input name="checkbox" type="checkbox" onclick="$(this).is(‘:checked’) && $(‘#checked’).slideDown(‘slow’) || $(‘#checked’).slideUp(‘slow’);" />
-
<p style="display: none; margin: 10px; height: 100px; background-color: #f5f5f5; padding: 10px" id="checked"> </p>
-
Put some content here
Basicly the paragraph container named checked is hidden untill one presses the checkbox.
Posted by Anthony under jquery,snippets | Comments (7)
why do i have to leave a comment?
Comment by Barry Burton — June 18, 2008 @ 3:05 pm
sdfdsfsfxfsf
Comment by Barry Burton — June 18, 2008 @ 3:05 pm
Hi Barry, you dont have to leave a comment lol. Its a feature built into wordpress.
Comment by Anthony LeBoeuf — June 18, 2008 @ 3:10 pm
Nice!
Comment by Nick — August 6, 2008 @ 11:52 am
Hi! I’m Crystal. I am almost 19.

I guess worcesterwideweb.com – nice name for this site!
It is so interestingly here, especially in this category.
I was surfed about 3 hours before found this forum. I think i’ll be here for a long time! :-*
Comment by AMistyCrissy — October 10, 2008 @ 10:34 am
Works great!
But line 5 is outside the in the code…
Correct end of the code:
Put some content here
Comment by Farid el Nasire — March 5, 2009 @ 4:07 am
Ah yup good call, check the demo it has correct code.
Comment by Anthony — March 8, 2009 @ 5:56 pm