How-to articles, tricks, and solutions about DOM

How to Copy the Text to the Clipboard with JavaScript

Copying the text to clipboard makes it easier using the web page, so users will definitely like this functionality. You can create it by the help of JavaScript and we’re here to help you.

How to Create a New DOM Element from HTML String

Read this JavaScript tutorial and find the method that is used for creating a new DOM element from an HTML string. Get the explanation and see examples.

How to Create a Scroll Indicator with JavaScript

Know how to create a scrollbar indicator element on your webpage which indicates how far the user has scrolled down the page. Use a little JavaScript code to animate your webpage bar.

How to Create and Trigger Event in JavaScript

Read this tutorial and learn how you can create and dispatch the DOM Events in JavaScript. Also, learn to add custom data and trigger built-in events.

How to Detect a Click Outside an Element

A common pattern used in JavaScript is detecting a click outside an element. This snippet offers you the most efficient ones among the various solutions.

How to Detect Idle Time in JavaScript

Read this tutorial and learn useful information about the vanilla JavaScript and jQuery solutions that are used for detecting the idle time correctly.

How to Get Image Size Using JavaScript

Read this tutorial and learn the two methods of getting the width and height of the image. Learn about the properties that help to get the image size.

How to Get the data-id Attribute

Read this tutorial and learn the right ways of getting the data-id attribute using jQuery two methods. Also, learn more information about the two methods.

How to Get the Value of Text Input Field Using JavaScript

Read this tutorial and learn about several methods of getting the value of the input textbox value without wrapping the input element inside a form element.

How to Insert an Element After Another Element in JavaScript

Read this JavaScript tutorial and learn useful information about modern approaches of inserting an element after another element using two easy methods.

How to Remove All the Child Elements of a DOM Node in JavaScript

Read this JavaScript tutorial and learn several simple and fast methods that are used for removing all the child elements of the DOM node with examples.

How to Scroll to the Top of the Page Using JavaScript

Read this tutorial and find useful information about the simplest native JavaScript method and its parameters to make the page jump on the top instantly.

How to Strip HTML from a String in JavaScript

In this tutorial, you will find several approaches to strippingan HTML from a sting in JavaScript easily. Get the codes and explanations right away.

How to Test If a Checkbox is Checked with jQuery

In this tutorial, you will find several jQuery methods that are used for testing whether the checkbox is checked based on the different versions you use.

Remove a child with a specific attribute, in SimpleXML for PHP

You can remove a child element with a specific attribute in SimpleXML for PHP using the xpath() function.