Found 10483 Articles for Web Development

Node name of an HTML element using javascript?

Manisha Patil
Updated on 23-Aug-2022 13:44:23

703 Views

A string representation of the given node's name is returned by the nodeName property. When a node has attributes, it produces a string with the name of the corresponding attribute. When a node is an element, it returns a string with the name of the tag. This property can only be read. Each element on a webpage can be accessed through a node, which is a component of the DOM tree. Every node is an object with a number of methods and properties; this is why nodes are sometimes known to as node objects. The browser builds a tree ... Read More

HTML DOM emphasized object

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

123 Views

The HTML DOM emphasized object is associated with the HTML element. The element is used for emphasizing some text and it marks that text in italic. You can create and access emphasized object using createElement() or getElementById() method respectively.SyntaxFollowing is the syntax for −Creating an emphasized object −var e = document.createElement("EM");ExampleLet us look at an example for the emphasized object −Live Demo emphasized object example Create an em element by clicking the button below CREATE    function createEM() {       var e = document.createElement("EM");       var txt = document.createTextNode("HELLO WORLD"); ... Read More

First and last child node of a specific node in JavaScript?

Lokesh Yadav
Updated on 09-Dec-2022 10:04:58

760 Views

In this article we are going to learn about the first and last child node of a specific node in JavaScript along with suitable examples. To get the first and last child node of a specific node, there are existing properties called firstChild, lastChild, firstElementChild and lastElementChild. The difference between the property of firstChild and firstElementChild is that in contrast to firstElementChild, firstChild treats both text and comments contained within html elements as children. The firstChild also considers the whitespace in the text. The same is applicable for lastChild and lastElementChild. To get the first child of a list The ... Read More

Remove the child node of a specific element in JavaScript?

Lokesh Yadav
Updated on 09-Dec-2022 09:57:51

5K+ Views

In this article we are going to discuss how to remove the child node of a specific element in JavaScript with appropriate examples. To remove the child node of a specific element, there is an existing method in JavaScript called removeChild(). The removeChild() method is different from the remove() method. The remove() method helps us to remove itself. Whereas, with the help of the removeChild() method, we can remove the child node from the parent node. Now, let’s look into the syntax and usage of removeChild() property. Syntax The syntax for removeChild() method is − removeChild(childNode); Where, childNode is ... Read More

Sibling of a list element in JavaScript?

Lokesh Yadav
Updated on 09-Dec-2022 09:54:34

6K+ Views

In this article, we are going to learn about the sibling of a list element in JavaScript with suitable examples. To find the sibling of a list element in JavaScript, there is an existing property called nextSibling. The nextSibling property returns the next node on the same tree level. The nextSibling returns a node object and it is a read-only property. Note − The nextSibling propery returns the next sibling node: An element node, a comment node, a text node. The whitespaces in between the elements are also considered as text nodes. Now, Let’s look into the syntax and usage ... Read More

HTML DOM Input Password name Property

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

142 Views

The HTML DOM Input Password name property is used for setting or returning the name attribute of an input password field. The name attribute helps in identifying the form data after it has been submitted to the server. JavaScript can also use the name attribute to refer form elements to manipulate later on.SyntaxFollowing is the syntax for −Setting the name property −passwordObject.name = nameHere, name is for specifying the password field name.ExampleLet us look at an example for the password name property −Live Demo Input Password name Property Password: Change the name of the password field by ... Read More

HTML DOM Input Password maxLength Property

AmitDiwan
Updated on 19-Feb-2021 08:11:34

406 Views

The HTML DOM Input Password maxlength property is used for setting or returning the maxlength attribute of the input password field. The maxLength property specifies the maximum number of characters you can type in a password field.SyntaxFollowing is the syntax for −Setting the maxLength property −passwordObject.maxLength = integerHere, integer specifies the maximum number of characters that can be typed in the password field.ExampleLet us look at an example for the maxLength form property −Live Demo Input Password maxLength Property Password: Increase the maximum number of characters to be entered for the above field by clicking below button ... Read More

HTML DOM Input Password form Property

AmitDiwan
Updated on 19-Feb-2021 09:01:52

177 Views

The HTML DOM Input Password form property is used for returning the form reference that contains the input password field. If the input password field is outside the form then it will simply return NULL. This property is read-only.SyntaxFollowing is the syntax for input password form property.passwordObject.formExampleLet us look at an example for the Input Password form property −Live Demo Input Password form Property Password: Get the form id by clicking on the below button GET FORM    function formId() {       var P=document.getElementById("PASS").form.id;       document.getElementById("Sample").innerHTML = "The id ... Read More

HTML DOM Input Password disabled Property

AmitDiwan
Updated on 19-Feb-2021 09:05:34

177 Views

The HTML DOM Input Password disabled property is used for setting or returning whether the password field is disabled or not. It uses boolean values with true representing the element should be disabled and false otherwise. The disabled property is set to false by default. The disabled element is greyed out by default and is unclickable.SyntaxFollowing is the syntax for −Setting the disabled property −passwordObject.disabled = true|false;Here, true=password field is disabled and false=the password field is not disabled. It is false by default.ExampleLet us look at an example for the Input password disabled property −Live Demo Input Password ... Read More

HTML DOM Input Password defaultValue Property

AmitDiwan
Updated on 19-Feb-2021 09:07:25

306 Views

The HTML DOM Input Password defaultValue property is used for setting or getting the defaultValue of a password field. The defaultValue of an element is the value assigned to the value attribute. The difference between value property and defaultValue property is that the defaultValue property retains the original default value specified while the value property change based on the user input in the input field.SyntaxFollowing is the syntax to set the defaultValue property −passwordObject.defaultValue = valueHere, “value” is the password field default value.ExampleLet us look at an example for the Input Password defaultValue property −Live Demo Input Password ... Read More

Advertisements