which and button Property | Cross Browser Solution

which and button both JS properties are used to examine the mouse or keyboard event. The difference between them is that which property supports only the latest versions of browsers or modern browsers and the button property is to work in older versions of browsers like internet explorer version below than 9.0 which Property in … Read more which and button Property | Cross Browser Solution

Print the List of All CSS properties And Their Default Value in JS

There is a predefined function in Java-Script to print the complete list of CSS properties which is getComputedStyle(). It returns CSS properties of an HTML element with their default value. getComputedStyle() return properties in an object. The first argument of it will contain the selected element. So to access data from object by index, we … Read more Print the List of All CSS properties And Their Default Value in JS

Print A Maximum Number From An Array in JavaScript

This guide includes two ways of printing maximum numbers from an array in Javascript. First, we will learn how to print the max number using a predefined method Math.max(). And the second one is, using a loop. This one is tricky but not that if you read code example line by line and understand. Table … Read more Print A Maximum Number From An Array in JavaScript

How To Remove Default Behavior of Form’s Submit Button in JS

When we click on the submit button of form or press enter. Then our form submits. There is a method in Javascript to remove this functionality of the HTML form which name is preventDefault(). preventDefault() method of Javascript can be used with two events – onclick & onsubmit. You need to write something in function’s … Read more How To Remove Default Behavior of Form’s Submit Button in JS

How To Change Class Name of an HTML Element in Javascript?

This article will guide you on how you can change or replace the existing class name of an HTML element with the help of JS (Javascript). There is a property in Javascript to replace the existing class value or to add the class on the Html tag, which is className. If the element has not … Read more How To Change Class Name of an HTML Element in Javascript?

How To Get Live Width of Window When It is Resizing?

To return the live width of the current window in Javascript, use a property of the window that is innerWidth. Step: 1 Write HTML documentation and use a script tag to code in Javascript. Step: 2 Pass onresize event on the window. Now, the code in the onresize event function will execute as many times … Read more How To Get Live Width of Window When It is Resizing?