Blog

python tutorials and learn python

Created with Sketch.

JavaScript getComputedStyle

JavaScript getComputedStyle Summary: in this tutorial, you will learn how to use the JavaScript getComputedStyle() to get the computed CSS properties of an element. Introduction to JavaScript getComputedStyle() method The getComputedStyle() is a method of the window object, which returns an object that contains the computed style an element: let style = window.getComputedStyle(element [,pseudoElement]); Code…
Read more

JavaScript Style

 JavaScript Style Summary: in this tutorial, you will learn how to use the style property to manipulate the inline style of the HTML elements. Setting inline styles To set the inline style of an element, you use the style property of that element: element.style Code language: CSS (css) The style property returns the read-only CSSStyleDeclaration…
Read more

JavaScript hasAttribute

JavaScript hasAttribute Summary: in this tutorial, you will learn how to use the JavaScript hasAttribute() to check if an element has an attribute. Introduction to the JavaScript hasAttribute() method To check an element has a specified attribute or not, you use the hasAttribute() method: let result = element.hasAttribute(name); Code language: JavaScript (javascript) Parameters The hasAttribute()…
Read more

JavaScript removeAttribute

JavaScript removeAttribute Summary: in this tutorial, you will learn how to use the JavaScript removeAttribute() to remove the attribute with the specified name from the element. Introduction to JavaScript removeAttribute() method The removeAttribute() removes an attribute with a specified name from an element: element.removeAttribute(name); Code language: CSS (css) Parameters The removeAttribute() accepts an argument which…
Read more

JavaScript getAttribute

JavaScript getAttribute Summary: in this tutorial, you will learn how to use the JavaScript getAttribute() method to get the value of a specified attribute on an element. Introduction to the JavaScript getAttribute() method To get the value of an attribute on a specified element, you call the getAttribute() method of the element: let value =…
Read more

JavaScript setAttribute

JavaScript setAttribute Summary: in this tutorial, you will learn how to use the JavaScript setAttribute() method to set a value for an attribute on a specified element. Introduction to the JavaScript setAttribute() method To set a value of an attribute on a specified element, you use the setAttribute() method: element.setAttribute(name, value); Code language: CSS (css)…
Read more

Understanding Relationships Between HTML Attributes & DOM Object’s Properties

Understanding Relationships Between HTML Attributes & DOM Object’s Properties Summary: in this tutorial, you will learn the relationships between HTML attributes and DOM object’s properties. When the web browser loads an HTML page, it generates the corresponding DOM objects based on the DOM nodes of the document. For example, if a page contains the following…
Read more

JavaScript removeChild

JavaScript removeChild Summary: in this tutorial, you will learn how to use the JavaScript removeChild() method to remove a child node from a parent node. Introduction to JavaScript removeChild() method To remove a child element of a node, you use the removeChild() method: let childNode = parentNode.removeChild(childNode); Code language: JavaScript (javascript) The childNode is the…
Read more

JavaScript cloneNode

JavaScript cloneNode Summary: in this tutorial, you will learn how to use the JavaScript cloneNode() method to clone an element. The cloneNode() is a method of the Node interface that allows you to clone an element: let clonedNode = originalNode.cloneNode(deep); Code language: JavaScript (javascript) Pamaraters deep The cloneNode() method accepts an optional parameter deep: If…
Read more

JavaScript replaceChild

JavaScript replaceChild Summary: in this tutorial, you will learn how to use the JavaScript Node.replaceChild() method to replace an HTML element by a new one. To replace an HTML element, you use the node.replaceChild() method: parentNode.replaceChild(newChild, oldChild); Code language: CSS (css) In this method, the newChild is the new node to replace the oldChild node…
Read more