![]() |
Javascript/Prototype Situation
Hey,
I've made a form, theirs a link that when clicked on, it adds another input box below the other. javascript Code:
|
Add a counter?
So each time they click the link, the counter increments. |
As bdm said.
javascript Code:
|
I was going to code it out but I was in the middle of playing CoD4. :-)
I guess also if you want an alternative. You could find everything with the name of 'poll_choice', and count how many their are. Although the first method is much simpler. |
I wrote a slightly fuller example, more to keep me occupied than anything else, which might be of use. Instead of hard-coding the HTML to be repeated, I told prototype to use what's already in the HTML -- that might be super useful, or superfluous, for you.
The essential function makes use of some of Prototypes great features: JavaScript Code:
A full test page HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">If you really want to keep the HTML hard-coded then a viable option would be: JavaScript Code:
|
Ah, so I guess my suggested alternative wasn't such a bad idea.
And good call on the clone method. ;-) |
Thanks to all who responded :) and thanks for the help, I appreciate it a lot! :D
|
| All times are GMT. The time now is 11:15 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0