X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM getElementsByName() Method

Document Object Reference Document Object

Definition and Usage

The getElementsByName() method accesses all elements with the specified name.

Syntax

document.getElementsByName(name)

Parameter Description
name Required. The name of the element you want to access/manipulate


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The getElementsByName() method is supported in all major browsers.


Example

Example

Alert the number of elements with a specific name:

<script>

var x=document.getElementsByName("x");
alert(x.length);

</script>

Try it yourself »


Document Object Reference Document Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook