By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

onClick Toggle - Help Please!

P: n/a
Hi... I have a problem and I hope someone can help me out!

I have two series of radio buttons...(call them Group A and Group B)
and a Textarea.

When you click on any of the radio buttons in the A group, it
automatically adds some text to the textarea, using a javascript
onClick function.

When you click on any of the radio buttons in the B group, it appends
another line of text to the existing text already in the textarea,
again, using a javascript onClick function

What I need is to make the group B onClick act like a toggle, so if
the associated text isn't there, it will add it... but if it IS
there... it will remove it.

If that's not clear enough... here's an example

------------------------
Group A
Radio1 Radio2 Radio3 Radio4 Radio5

Group B
Radio1 Radio2 Radio3 Radio4 Radio5

TextArea
-------------------------

If Group A/Radio1 is clicked it adds the text
"Here is some text." to the textarea

Then, if Group B/Radio1 is clicked it appends the text
" And here is some more." to the existing text.... So the final text
is: "Here is some text. And here is some more."

If I then click GroupB/Radio1 again.... I'd like it to remove the
GroupB/radio1 text, leaving the GroupA text alone and giving me just:
"Here is some text"

So.....

Click GroupA/Radio1
"Here is some text"

Click GroupB/Radio1 once:
"Here is some text. And here is some more"

Click GroupB/Radio1 again:
"Here is some text"

Does that make sense? Can someone help me please?

Thanks!. Sarah :)


Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Nevermind... I figured it out.... :p
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.