Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to getElementsByName() with context other than document?

Tags:

javascript

I am unable to search for nodes with a specific name with any other context than document.

is there a cross browser way to search getElementsByName() with a context other than document.getElementsByName()?

like image 342
tester Avatar asked Jan 25 '26 09:01

tester


1 Answers

getElementsByName is a property of the document only, in all browsers. You cannot add it to the element object prototype in all browsers, and even if you could it would be less efficient than the native implementation. You can do whatever filtering you need on the nodelist returned from document.

like image 183
kennebec Avatar answered Jan 27 '26 23:01

kennebec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!