Found 2202 Articles for HTML

HTML DOM DragEvent

AmitDiwan
Updated on 20-Feb-2021 05:16:34

249 Views

The HTML DOM DragEvent is a type of event that gets executed whenever the selected text is being dragged and dropped. This event was introduced in HTML5.PropertiesFollowing is the property for the HTML DOM DragEvent −PropertyDescriptiondataTransferTo return the data that is being dragged or dropped by the user.SyntaxFollowing is the syntax for DragEvent −Object.DragEventType= function_name;Here, function_name is the function that we want to execute on the event being executed.EventsFollowing are the event types belonging to the DragEvent object −EventDescriptionondragOccurs when an element is being dragged.ondragendOccurs when the element has been finished dragging by the user.ondragenterOccurs when the element enters the ... Read More

HTML DOM dl object

AmitDiwan
Updated on 20-Feb-2021 05:28:28

262 Views

The HTML DOM dl object is associated with the HTML element. The element is for creating the description list. Using the dl object we can dynamically create and acess the element using JavaScript.SyntaxFollowing is the syntax for −Creating a description list −var p = document.createElement("DL");ExampleLet us look at an example for the dl object −Live Demo Div object example Create a div by clicking the below button CREATE    function createDiv() {       var Desc = document.createElement("DL");       var DesT = document.createElement("DT");       var tn= document.createTextNode("Mango");     ... Read More

HTML DOM div object

AmitDiwan
Updated on 20-Feb-2021 05:30:06

513 Views

The HTML DOM div object is associated with the HTML element. Div is a general purpose block level element that allows us to group elements together to either apply style to them or to manipulate a group of HTML elements under a single tag name or id.PropertiesFollowing is the property for div object −PropertyDescriptionAlignTo set or return the align attribute value of the element. This property is not supported in HTML5 use css instead for aligning.SyntaxFollowing is the syntax for −Creating a div object −var p = document.createElement("DIV");ExampleLet us look at an example for the HTML DOM div ... Read More

HTML DOM dir property

AmitDiwan
Updated on 20-Feb-2021 05:31:34

154 Views

The HTML DOM dir property is used for changing an element’s text direction from default left to right to right to left or auto. The dir property is used for setting and returning the dir attribute value of an element. The returned dir attribute value is of type string.SyntaxFollowing is the syntax for −Setting the dir property −HTMLElementObject.dir = "ltr|rtl|auto"Here, ltr=left to right text direction and it is the default text direction., rtl=right to left text direction, auto=text direction is based on content here and is usually figured by the web browser.ExampleLet us look at an example for the HTML ... Read More

HTML DOM Dialog object

AmitDiwan
Updated on 20-Feb-2021 05:32:58

464 Views

The HTML DOM Dialog object is associated with the HTML5 element. It is used for creating popups, modals, etc on the web page. To view the dialog box and let the user interact with it the open attribute value should be set.PropertiesFollowing are the properties for the Dialog object −PropertyDescriptionopenTo set or return if the dialog should be opened or not.returnValueTo set or return the return value of the dialog.MethodsFollowing are the methods for the Dialog object −MethodDescriptionclose()To close the dialog.show()To show the dialog.showModal()To make the top most dialog box and display it.SyntaxFollowing is the syntax for −Creating a ... Read More

HTML DOM DD object

AmitDiwan
Updated on 20-Feb-2021 05:34:51

112 Views

The HTML DOM DD object is associated with the HTML element present inside the Definition list denoted by element in the HTML document.SyntaxFollowing is the syntax for −Creating a DD object −var p = document.createElement("DD");ExampleLet us look at an example for the HTML DOM DD object −Live Demo dd object example Click the button below to create a dd element with some text in it CREATE Mango    function create_dd() {       var d = document.createElement("DD");       var txt = document.createTextNode("Mango is called the king of fruits.");     ... Read More

HTML DOM Datalist options Collection

AmitDiwan
Updated on 20-Feb-2021 05:36:25

454 Views

The HTML DOM Datalist options collection is used for setting or returning the option value collection that are present inside the HTML element. The elements appear in the same order as they are in the document.PropertiesFollowing is the property for the Datalist options Collection −PropertyDescriptionlengthTo return the number of elements in the collection.It is a read-only property.MethodsFollowing are the methods for the Datalist options collection −MethodDescription[index]To return the element from the collection present at the specified index.Indexing starts from 0 and null is returned if the index number is out of range.item(index)To return the element from ... Read More

HTML DOM Datalist Object

AmitDiwan
Updated on 20-Feb-2021 05:39:19

225 Views

The HTML DOM Datalist object is associated with the HTML5 element.SyntaxFollowing is the syntax −To create Datalist object −var p = document.createElement("DATALIST");To access Datalist object −var p = document.getElementById("demoDatalist");ExampleLet us look at an example for the HTML DOM Datalist object −Live Demo DATALIST    button{       margin-top:90px;    } Datalist object example Click the below button to create a datalist element with options CREATE    function createData() {       var i = document.createElement("INPUT");       i.setAttribute("list", "fruits");       document.getElementById("FORM1").appendChild(i);       var ... Read More

HTML DOM contains() Method

AmitDiwan
Updated on 22-Nov-2023 04:42:39

1K+ Views

The HTML DOM contains() method is used to find whether a node is the descendant of the specified node. A descendant can be an immediate child of the node, grandchild and even great-grandchild. It returns a boolean true indicating the node is indeed the descendant of the specified node and false if it isn’t the descendent of the given node. Syntax Following is the syntax for the HTML DOM contains() method − node.contains(givenNode) Here, the givenNode is a mandatory parameter value that specifies if the givenNode is being contained by the node. Example Let us look at an example for ... Read More

HTML DOM console.warn() Method

AmitDiwan
Updated on 08-Aug-2019 12:45:57

197 Views

The HTML DOM console.warn() method is used to display a warning message in the console. In some browsers there is a small exclamation mark in console log for these warnings The console.warn() method will not interrupt your code execution. Developers can use the console.warn() method to give warnings to the user about some user action.SyntaxFollowing is the syntax for console.warn() method −console.warn(message)Here, the message is a mandatory parameter of type string or object. It is displayed as a warning in the console view.ExampleLet us look at an example for the console.warn() method − console.warn() Method Click the below ... Read More

Advertisements