HTML | DOM Meta name Property

The HTML DOM Meta name Property is used for returning or setting the name of the name and it is used to reference form data when it has been submitted by the user. It also refers to the element in the javascript.

Syntax:

  • It is used to return the name property.
    metaObject.name
  • It is used to set the name property.
    metaObject.name = name

Property Values:



  • name: It specify the name of the Meta Element.

Return Value: It returns a string value which represent the name of the Meta Element.

Example 1: This program illustrates how to return the name Property.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
  
<head
    <meta name="keywords"
        content="Meta Tags, Metadata"  /> 
</head
  
<body
    <center
        <h1>GeeksForGeeks</h1
        <h2>DOM Meta name Property</h2
        <p>Hello GeeksforGeeks!</p
          
        <button onclick="myGeeks()"
        Submit</button
          
        <p id="sudo"></p
          
        <script
            function myGeeks() { 
                var x = 
                document.getElementsByTagName( 
                "META")[0].name;
                
                  
                document.getElementById( 
                "sudo").innerHTML = x; 
            
        </script
</center
</body
  
</html>

chevron_right


Output:
Before Clicking On Button:

After Clicking On Button:

Example-2: This program illustrates how to set the name Property.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
  
<head
    <meta name="keywords"
        content="Meta Tags, Metadata"  /> 
</head
  
<body
    <center
        <h1>GeeksForGeeks</h1
        <h2>DOM Meta name Property</h2
        <p>Hello GeeksforGeeks!</p
          
        <button onclick="myGeeks()"
        Submit</button
          
        <p id="sudo"></p
          
        <script
            function myGeeks() { 
                var x = 
                document.getElementsByTagName( 
                "META")[0].name = "Hello Geeks";
                
                  
                document.getElementById( 
                "sudo").innerHTML = x; 
            
        </script
</center
</body
  
</html>

chevron_right


Output:
Before Clicking On Button:

After Clicking On Button:

Supported Browsers: The browsers supported by DOM Meta name Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.