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

How to get a specific input field from input fields list share a same name?

P: 28
Hi, I have multiple input fields which is sharing similiar elements name so it will submit a array to other page.
Whereas, i encounter a problem now, i want get number third element from the list in order to do specific change by javascript function.
How i suppose to do to get the element with the element name, any possible method to do it?
Jun 25 '09 #1
Share this Question
Share on Google+
2 Replies

P: 162
could you mention some sample code, that would make easier ..
1. input field declare with a ID and in javascript call that ID getElemenetById(id_name) would do your job.
Jun 25 '09 #2

Expert Mod 15k+
P: 16,027
Another option is to use document.getElementsByName():
Expand|Select|Wrap|Line Numbers
  1. var elems = document.getElementsByName("element_name");
  2. var third_elem = elems[2];
Jun 25 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.