Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM Object data Property

  • Difficulty Level : Basic
  • Last Updated : 24 Nov, 2021

The HTML | DOM Object data Property is used to set or return the value of the data attribute of an <object> element. The data attribute is used to specify the URL of the resource which will be used by the object.

  • Return the data property.
  • It is used to set the data property. = URL

Property Values: It contains the value i.e URL which specifies the URL of the resource. 

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

  • Absolute URL: It is used to point another website.
  • Relative URL: It points to link within a website.

Return Value: It returns a String that represents the object URL. Returns the full URL, including the protocol (like http://)

Example: This Example returns a data Property. 


<!DOCTYPE html>
        <object id="myobject"
        <h2>DOM Object data Property</h2>
        <button onclick="Geeks()">
            Click it
        <p id="gfg"
        function Geeks() {
            // Accessing Object element.
            var x =
                "gfg").innerHTML = x;

Before Clicking On Button: 

After Clicking On Button: 

Supported Browsers: 

  • Google Chrome 
  • Mozilla Firefox 
  • Edge 
  • Safari 
  • Opera 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!