Javascript form help?

0 views
Skip to first unread message

Marla Erwin

unread,
Sep 4, 2007, 3:53:00 PM9/4/07
to Refresh...@googlegroups.com
So ... I've a text field associated with a checkbox. Something like:

<p><input type="checkbox" /><input type="text" value="Add tag here" /></p>

What needs to happen when the user clicks in the text field is this:
  1. Default text clears.
  2. Checkbox is checked.
  3. New line appears that is a duplicate of the original: an unchecked checkbox and text field with "Add tag here" text. And this should repeat as user clicks in each new text field.
#1 and #2 are no problem, but #3 eludes me. Help, anyone? (And those P tags can be DIVs, LIs, whatever -- doesn't matter to me.)

If you can point me toward a quick solution, you have my undying gratitude and free beer/coffee at the next meeting.
If it's long and difficult, tell me what you'd charge to just write the &$%@#* thing for me so I can get back to my life.  :)

thanks
Marla


Ryan Joy

unread,
Sep 4, 2007, 5:43:00 PM9/4/07
to Refresh...@googlegroups.com
Marla,

You will find what I was able to come up with here:
http://www.atxryan.com/test_marla.html

The usual disclaimers are applicable: only tested in firefox, coded it
fast so it's not as pretty as it could be, etc.

Hopefully this will help steer you in the right direction. If you need
more or would like me to abstract this further and get it worthy of
production, contact me off list.

Regards,

-RYAN

Marla Erwin wrote:
> So ... I've a text field associated with a checkbox. Something like:
>
> <p><input type="checkbox" /><input type="text" value="Add tag here" /></p>
>
> What needs to happen when the user clicks in the text field is this:
>

> 1. Default text clears.
> 2. Checkbox is checked.
> 3. New line appears that is a duplicate of the original: an unchecked

Marla Erwin

unread,
Sep 4, 2007, 11:04:05 PM9/4/07
to Refresh...@googlegroups.com
Ryan, you rock. Just what I needed, thanks.
Marla
Reply all
Reply to author
Forward
0 new messages