HTML DOM Source Object

Source Object

The Source object is a new object in HTML5.

The Source object represents the HTML <source> element.

Access Source Object

You can access the <source> element by using getElementById():

var x = document.getElementById("mySource");

Try it yourself

Create Source Object

You can create a <source> element by using the document.createElement() method:

var x = document.createElement("SOURCE");

Try it yourself

Source Object Properties

Properties Description
media Set or return the value of the media attribute of the <source> element.
src Set or return the value of the src attribute of the <source> element.
type Sets or returns the value of the type attribute of the <source> element.

Standard Attributes and Events

The Source Object Supports StandardsPropertiesAndEvents.

Related Pages

HTML Reference Manual:HTML <source> Tag