Howdy_McGee Posted June 30, 2010 Share Posted June 30, 2010 I was wondering if it's possible to get an element by name, sorta like a toTop link. (Ex. href="#top" - somwhere else on page - name="top")I'm trying to write a hover script and link the href="#ID" to another div with the name="ID", is there anyway to do this? Link to comment Share on other sites More sharing options...
Ingolme Posted June 30, 2010 Share Posted June 30, 2010 You should just use the ID attribute. The name attribute is deprecated in favor of ID for all elements except <input>, <select> and <textarea> Link to comment Share on other sites More sharing options...
jeffman Posted June 30, 2010 Share Posted June 30, 2010 FWIW, there is an HTML5 getElementsByName method (note the 's') but it is not universally supported yet. So you wouldn't want to use it anyway. Link to comment Share on other sites More sharing options...
End User Posted June 30, 2010 Share Posted June 30, 2010 You should just use the ID attribute. The name attribute is deprecated in favor of ID for all elements except <input>, <select> and <textarea>I'm not sure that's actually correct...according to the spec it's only deprecated for the elements: a, applet, form, frame, iframe, img, and map. It's still used for all other form elements (radio, checkbox, text, etc). Link to comment Share on other sites More sharing options...
boen_robot Posted June 30, 2010 Share Posted June 30, 2010 I'm not sure that's actually correct...according to the spec it's only deprecated for the elements: a, applet, form, frame, iframe, img, and map. It's still used for all other form elements (radio, checkbox, text, etc).And the radio, checkbox, text, etc. are implemented by which elements? ... The "input" (with different types such as radio, checkbox, etc.), "select" and "textarea", which is what DD said.(If you can see an element that is not one of these, and does not deprecate the use of the form element on it, then you'd be right...) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.