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

javascript getting elements by tag attributes not just its name

P: 1
I'd like to know if there is some way to get document elements by their attributes not just by their names like the following :
document.getElementsByTagName("input")
as the previous function will return an array of all the input tags whatever the type is text or checkbox or any thing else .But I want someway to give me back the "input" tags of type checkbox only for example or of name starts with "checkbox2007" or whatever the attributes of the tag is .

Thank you ;
Oct 11 '07 #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,390
hi ...

welcome to TSDN ...

loop through your list and check for the desired attributes and their values with:

Expand|Select|Wrap|Line Numbers
  1. node.getAttribute('attr_name') == 'whatever_value_that_should_match';
kind regards
Oct 11 '07 #2

Post your reply

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