jQuery .click() .toggle() - change display and swap character
Posted
by danit
on Stack Overflow
See other posts from Stack Overflow
or by danit
Published on 2010-06-09T14:35:43Z
Indexed on
2010/06/09
14:42 UTC
Read the original article
Hit count: 153
jQuery
Here is my jQuery:
$('.ask').click(function() {
$('.addtitle').slideToggle('fast', function() {
// Animation complete.
});
});
And my HTML:
<p class="ask">+</p>
<div class="addtitle">
<p>Give your Idea a great title</p>
<form name="input" action="#" method="get">
<input id="title" type="text" name="title" />
<input id="go" type="submit" value="Go" />
</form>
</div>
I have multiple .ask div's on the page and I only want it to effect the .next() div named .ask rather than all div's named .ask.
I also want to .toggle() the '+' character to '-'
Can anyone assist?
© Stack Overflow or respective owner