Found 2416 Articles for HTML

HTML DOM firstElementChild property

AmitDiwan
Updated on 19-Feb-2021 07:28:35

33 Views

The HTML DOM firstElementChild property is used for returning the first child element of a given element. The child element is returned as an element node only. It ignores the text and comment nodes and doesn’t consider them. This is a read-only property.SyntaxFollowing is the syntax for HTML DOM firstElementChild property −element.firstElementChildExampleLet us look at an example for the firstElementChild property −Live Demo    function eleChild() {       var ch = document.getElementById("DIV1").firstElementChild.innerHTML;       document.getElementById("Sample").innerHTML = "The first element child node of the div is :"+ch;    } firstElementChild property ... Read More

HTML DOM firstChild property

AmitDiwan
Updated on 19-Feb-2021 07:30:02

152 Views

The HTML DOM firstChild property is used for returning the first child node of a specific node as a node object. It can return as a text node, element node or a comment node depending on which node is the first. This is a read-only property.SyntaxFollowing is the syntax for the HTML DOM firstChild property −node.firstChildExampleLet us look at an example for the firstChild property −Live Demo    function getFirst() {       var ch = document.getElementById("DIV1").firstChild.innerHTML;       document.getElementById("Sample").innerHTML = "The first child node of the div is :"+ch;    } ... Read More

HTML DOM Figure object

AmitDiwan
Updated on 19-Aug-2019 07:40:08

90 Views

The HTML DOM Figure object is used for reperesenting the HTML element. We can dynamically create and access a figure element using the figure object.SyntaxFollowing is the syntax for creating a Figure object −var p = document.createElement("FIGURE");ExampleFollowing is how you can create Figure object −    function createFigure(){       var fig = document.createElement("FIGURE");       fig.setAttribute("id", "Figure1");       document.body.appendChild(fig);       var i = document.createElement("IMG");       i.setAttribute("src", "https://www.tutorialspoint.com/servlets/images/servletsmini-logo.jpg");       i.setAttribute("width", "250");       i.setAttribute("height", "200");       i.setAttribute("alt", "Eiffel Tower");       fig.appendChild(i);   ... Read More

HTML DOM Figcaption object

AmitDiwan
Updated on 19-Feb-2021 07:35:22

85 Views

The HTML DOM Figcaption object is used for representing the HTML5 element. You can create or access a figcaption element using createElement() and getElementById() method respectively.SyntaxFollowing is the syntax for −Creating a Figcaption object −var p = document.createElement("FIGCAPTION");ExampleLet us look at an example for the Figcaption object −Live Demo    function createCaption() {       var caption = document.createElement("FIGCAPTION");       var txt = document.createTextNode("Learn Java Servlets");       caption.appendChild(txt);       var f=document.getElementById("Figure1");       f.appendChild(caption);    } Caption Create a caption for the below image by ... Read More

HTML DOM Fieldset type property

AmitDiwan
Updated on 19-Feb-2021 07:41:05

85 Views

The HTML DOM Fieldset type property is used for returning the fieldset element type. It will always be of type fieldset for a fieldset element. It is a read-only property.SyntaxFollowing is the syntax for Fieldset type property −fieldsetObject.typeExampleLet us take a look at an example for the Fieldset type property −Live Demo    function FieldType() {       var field = document.getElementById("FieldSet1").type;       document.getElementById("Sample").innerHTML = "The fieldset element is of type "+field;    } Sample FORM User Data: Name: Address: Age: GET TYPE ... Read More

HTML DOM Fieldset Object

AmitDiwan
Updated on 19-Feb-2021 07:44:28

111 Views

The HTML DOM Fielset object represents the element.PropertiesFollowing are the properties for Fieldset object −PropertyDescriptiondisabledTo set or return if the fieldset is disabled, or notformTo return the reference to the form that contains the given fieldset.nameTo set or return the name attribute value of a fieldset.typeTo return the fieldset element type.SyntaxFollowing is the syntax for −Creating a fieldset element −var p = document.createElement("FIELDSET");ExampleLet us look at an example for the HTML DOM Fieldset object −Live Demo    function createField() {       var f = document.createElement("FIELDSET");       var txt = document.createTextNode("FIELDSET element created"); ... Read More

HTML DOM Fieldset name property

AmitDiwan
Updated on 19-Feb-2021 07:46:39

175 Views

The HTML DOM Fieldset name property is used for getting or setting the name attribute value of a element. The name attribute helps in identifying the form data after the form has been submitted or for simply referencing the form elements.SyntaxFollowing is the syntax for −Setting the fieldset name property −fieldsetObject.name = nameHere, name specifies the fieldset name.ExampleLet us look at an example for the Fieldset name property −Live Demo    function fieldName() {       var field = document.getElementById("FieldSet1").name;       document.getElementById("Sample").innerHTML = "The fieldset name is "+field;    } ... Read More

HTML DOM Fieldset form property

AmitDiwan
Updated on 19-Aug-2019 06:57:00

108 Views

The HTML DOM Fieldset form property returns the form reference of the type form object. This is for the element that is present inside that given form. It is a read-only property. If the specified fieldset isn’t present inside the form then null is returnedSyntaxFollowing is the syntax for the fieldset form property −fieldsetObject.formExampleLet us look at an example for the fieldset form property −    function formId() {       var field = document.getElementById("FieldSet1").form.id;       document.getElementById("Sample").innerHTML = "The id of the form in which fieldset       element is present is ... Read More

HTML DOM Fieldset disabled property

AmitDiwan
Updated on 19-Feb-2021 08:03:10

302 Views

The HTML DOM Fieldset disabled property is used for disabling the group of elements that are present inside a given fieldset. If this property is set to true then the elements are disabled else they are enabled, which is by default as well. Disabled elements are rendered in grey by default by browsers and users can’t click or write in those elements.SyntaxFollowing is the syntax −To set the disabled property −fieldsetObj.disabled = true|falseTo return the disabled property −fieldsetObj.disabledExampleLet us look at an example for the Fieldset disabled property −Live Demo    function FieldDisable() {       ... Read More

HTML DOM exitFullscreen() method

AmitDiwan
Updated on 19-Aug-2019 06:42:46

31 Views

The HTML DOM exitFullscreen() method is used for getting an element currently in the full screen mode to get out of that mode. It does nothing if executed on an element that isn’t in the full screen mode already.SyntaxFollowing is the syntax for exitFullscreen() method −HTMLElementObject.exitFullscreen()ExampleLet us look at an example for the exitFullscreen() method −    var docEle = document.documentElement;    function GoNormal() {       if (document.exitFullscreen)       document.exitFullscreen();    }    function GoFullscreen() {       if (docEle.requestFullscreen)       docEle.requestFullscreen();    } exitFullscreen() method example ... Read More

Advertisements