Abhishek

Abhishek

68 Articles Published

Articles by Abhishek

Page 4 of 7

How to find the value of a button with JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 32K+ Views

In this tutorial, we will learn how to find the value of a button with JavaScript. Button elements often have a value attribute that stores important data for form processing or identification purposes. JavaScript provides the value property to access this attribute programmatically. Understanding how to retrieve button values is essential when working with HTML forms and interactive web applications. Button value Property The button value property returns the value of the value attribute assigned to a button element. This property is commonly used to distinguish between multiple buttons or pass specific data when forms are submitted. ...

Read More

How to fill columns with JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 775 Views

In this tutorial, we will learn how to fill columns with JavaScript using the columnFill property. This CSS property controls how content is distributed across multiple columns - either sequentially (auto) or with equal distribution (balance). The columnFill property specifies how columns should be filled when using CSS multi-column layout. It works in conjunction with columnCount to create responsive column layouts. Syntax Following is the syntax to set the columnFill property in JavaScript: selectedElement.style.columnFill = "value"; Here selectedElement is the DOM element you want to modify. The style property allows you to set ...

Read More

How to test if an element contains class in JavaScript in HTML?

Abhishek
Abhishek
Updated on 15-Mar-2026 10K+ Views

In JavaScript, we can check whether an HTML element contains a particular class using the classList.contains() method. This is especially useful when working with dynamic content or when you need to conditionally apply styles or behavior based on an element's classes. The classList.contains() method is the standard and most reliable way to test for class existence on DOM elements. Syntax element.classList.contains(className) Parameters: className - A string representing the class name to check for Return Value: Returns true if the element contains the specified class, false otherwise. Example: Basic ...

Read More

How to subtract days from a date in JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 37K+ Views

In JavaScript, you can subtract days from a date using built-in Date methods. The most common approaches are using setTime() with getTime() for millisecond-based calculation, or setDate() with getDate() for simpler day-based arithmetic. Following are the methods we can use to subtract days from a date in JavaScript: Using the setTime() and getTime() methods Using the setDate() and getDate() methods Using setTime() and getTime() Methods The setTime() method sets a date by milliseconds since ...

Read More

How to find the coordinates of the cursor with JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 19K+ Views

In this tutorial, we will learn how to find the coordinates of the mouse cursor with JavaScript. We need to determine the X and Y coordinates (horizontal and vertical positions) of the cursor on the screen when mouse events occur. JavaScript provides us with two essential properties to get the coordinates of the mouse cursor when events are triggered: Using event.clientX Property Using event.clientY Property Using event.clientX Property The event.clientX property returns the horizontal position (X-coordinate) of the cursor relative to the browser's viewport when an event is ...

Read More

How to submit an HTML form using JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 18K+ Views

In this tutorial, we will learn how to submit an HTML form using JavaScript. JavaScript provides multiple approaches to handle form submission, from direct programmatic submission to validation-based submission with user feedback. We will discuss two main methods for submitting HTML forms: Using the Form submit() Method Using Manual Validation Let us explore both methods with practical examples. Using the Form submit() Method The submit() method programmatically submits a form without requiring user interaction with the submit button. This method takes no parameters and returns no value—it ...

Read More

How to style background image to no repeat with JavaScript DOM?

Abhishek
Abhishek
Updated on 15-Mar-2026 3K+ Views

In this tutorial, we will learn to style the background image to no repeat with JavaScript DOM. To style the background image to no repeat with JavaScript, use the backgroundRepeat property. It allows you to set whether the background image repeats or not on a page. The use of images in the background really makes the page attractive. But before using the image in the background, one must completely understand the properties used to set the images as the background. Otherwise, it will create problems like not showing the full image in the background, repeating the image horizontally or ...

Read More

How to use JavaScript DOM to change the padding of a table?

Abhishek
Abhishek
Updated on 15-Mar-2026 1K+ Views

In this tutorial, we learn to use JavaScript DOM to change the padding of a table. To change the padding of a table, use the DOM padding property. The HTML table is used to display relational data on the user screen. We can easily show related or dependent data to the user and user can easily understand and determine the characteristics of the data with help of table. But, while we are showing the relational data to the user in the form of table, we need to make sure that the table is well structured and looking good according ...

Read More

How to use JavaScript to check if a number has a decimal place or it's a whole number?

Abhishek
Abhishek
Updated on 15-Mar-2026 26K+ Views

In JavaScript, determining whether a number is a whole number or has decimal places is a common requirement. This tutorial explores three effective methods to accomplish this task using both built-in JavaScript methods and custom functions. The following methods are available to check if a number is decimal or whole: Using the Math.floor() Method Using the Number.isInteger() Method Using a Custom isDecimal() Function Using Math.floor() Method The Math.floor() method returns the largest integer less than or equal to a given number. By comparing the original number with its ...

Read More

How to find out which JavaScript events fired?

Abhishek
Abhishek
Updated on 15-Mar-2026 16K+ Views

In this tutorial, we will learn how we can find out which JavaScript event is fired or triggered. We can add events to HTML elements to perform some actions on the webpage like changing text, form submission, etc. There are two ways of finding which JavaScript event is fired − Using Developer Tools Using Inspect Element Let us discuss both of them one by one with coding examples. Using Developer Tools We can find out which JavaScript event is fired by using developer tools in the browser. ...

Read More
Showing 31–40 of 68 articles
Advertisements