Open In App

HTML | DOM Emphasized Object

Last Updated : 22 Jan, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The DOM Emphasized Object is used to represent the HTML <em> element. The Emphasized element is accessed by getElementById().
Syntax:

document.getElementById("ID");

Where “id” is the ID assigned to the “em” tag.

Example-1:




<!DOCTYPE html>
<html>
  
<head>
    <title>DOM Emphasized Object</title>
</head>
  
<body>
    <center>
        <h2>DOM Emphasized Object</h2>
        
        <!--Text in Italics-->
        <p>Hello GeeksforGeeks</p>
        
        <!--Text in Emphasize-->
        <p><em id="GFG">Hello GeeksforGeeks</em></p>
        
        <button onclick="mygeeks()">
          Submit
        </button>
        
            <script>
                function mygeeks() {
                    var gfg = document.getElementById("GFG");
                    gfg.style.color = "red";
                    gfg.style.fontSize = "29px";
                }
            </script>
  </center>
</body>
  
</html>


Output:

Before Clicking On Button :

After Clicking On Button:

Example-2 :




<!DOCTYPE html>
<html>
  
<head>
    <title>DOM Emphasized Object</title>
</head>
  
<body>
    <h2>DOM Variable Object</h2>
    
    <!--Text in Paragraph-->
    <p>Hello GeeksforGeeks</p>
    
    <button onclick="mygeeks()">
      Submit
    </button>
    
        <script>
            function mygeeks() {
                var gfg = document.createElement("em");
                var text = 
                document.createTextNode("Hello GeeksForGeeks");
                gfg.appendChild(text);
  
                document.body.appendChild(gfg);
            }
        </script>
</body>
  
</html>


Output:

Before Clicking On Button:

After Clicking On Button:

Supported Browsers: The browser supported by DOM Emphasized Object are listed below:

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


Previous Article
Next Article

Similar Reads

How to render as emphasized text using HTML ?
The &lt;em&gt; tag in HTML is a phrase tag and used to emphasize the text content. It is similar to &lt;italic&gt; tag. The main difference between these two tag is the &lt;em&gt; tag semantically emphasizes on the important word or section of words while &lt;i&gt; tag is just offset text conventionally styled in italic to show alternative mood or
1 min read
How to find the title attribute of the first emphasized element in the page using jQuery ?
In JavaScript, we have a lot of different libraries for different purposes. jQuery is also a part of the JavaScript library which is made to simplify the JavaScript codes, and you can do animation to make your website more creative as well as dynamic. Before learning jQuery library you must have a basic knowledge of HTML, CSS, and JavaScript. In th
2 min read
HTML | DOM Object Object
The Object object represents only HTML &lt;object&gt; element. We can access any &lt;object&gt; element by using the getElementById(); and also can create object element by using createElement(); method.Syntax: It is used to access Object element document.getElementById("id"); It is used to create object element document.createElement("object"); Pr
2 min read
HTML | DOM HTML Object
The HTML Object property in HTML DOM is used to represent or access the HTML &lt;html&gt; element with in the object. The &lt;html&gt; element is used to return the HTML document as an Element Object. Syntax: It is used to access a &lt;html&gt; element.var x = document.getElementsByTagName("HTML")[0]; It can also be used to access a &lt;html&gt; el
3 min read
How to check a JavaScript Object is a DOM Object ?
Prerequisite: DOM (Document object model), Instanceof Operator DOM (Document Object Model): Document Object Model is a hierarchical representation of HTML and XML documents in a format that is easier to interpret in terms of programming. It makes manipulation of tags, elements, attributes, and classes by interpreting its structure in the form of a
2 min read
HTML DOM Object useMap Property
The HTML DOM Object useMap Property is used to set or return the value of the usemap attribute of an &lt;object&gt; element. The &lt;object&gt; usemap attribute is used to specify the name of an image-map to use with the object. The image with clickable areas is called an image map. The useMap attribute is related to the association with the &lt;ma
2 min read
HTML | DOM Input Week Object
The Input Week object in HTML DOM represents an &lt;input&gt; element with type = "week" attribute. The element can be accessed by using getElementById() method. Syntax: document.getElementById("id"); where id is assigned to the &lt;input&gt; tag. Property Values: list: It returns the reference of data list that contains the week field.form: It ret
3 min read
HTML | DOM Column Object
The Column Object in HTML DOM is used to represent the HTML &lt;col&gt; element. This tag is used to set or get the properties of &lt;col&gt; element. It can be accessed by using getElementById() method.Syntax: document.getElementById("Col_ID"); This Col_ID is assigned to HTML &lt; col &gt; element.Property Values: span: Used to set or return span
2 min read
HTML DOM Del Object
The Del Object in HTML DOM is used to represent the HTML &lt;del&gt; element. The &lt;del&gt; element can be accessed by getElementById(). Object Properties: cite: It is used to set or return the value of the cite attribute of a deleted element.dateTime: It is used to sets or return the value of the dateTime attribute of a deleted element. Syntax:
2 min read
HTML | DOM Embed Object
The Embed Object in HTML DOM is used to represent the &lt;embed&gt; element. The &lt;embed&gt; element can be accessed by using getElementById() method. Note: This object is new in HTML 5. Property Values: height: It sets or returns the value of the height attribute. src: It sets or returns the value of the src attribute of an Embed Object, type: I
2 min read
Article Tags :