Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Javascript Articles
Page 492 of 534
How to find the value of a button with JavaScript?
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 MoreHow to remove event handlers in JavaScript?
An event is defined as a change in an object's state. There are a number of events in HTML that show when a user or browser performs a certain action. JavaScript responds to these events when JavaScript code is embedded in HTML and allows execution. The process of responding to events is known as event handling. As a result, JavaScript uses event handlers to handle HTML events. In this article, we are going to discuss how to remove event handlers in JavaScript. Here, we use the removeEventListener() method to remove an event handler from an element in JavaScript. ...
Read MoreHow to count JavaScript array objects?
In this tutorial, we will learn to count JavaScript array objects. The array is the data structure containing the strings, numbers, objects, etc., in JavaScript. The object is the one kind of entity that contains properties and methods related to it. We can access the object's properties and invoke the object method using the object's references. Generally, To find the array length, we can use the array.length property and it returns the total number of elements that the array includes. But what if we need to count only object elements? Here, this tutorial has various approaches to counting ...
Read MoreHow to format a number with two decimals in JavaScript?
This tutorial will teach us how to format a number with two decimals using JavaScript. Formatting a number means rounding the number up to a specified decimal place. In JavaScript, we can apply many methods to perform the formatting. Some of them are listed as follows − The toFixed() Method Math.round() Method Math.floor() Method Math.ceil() Method Using toFixed() Method (Recommended) The toFixed() method formats a number with a specific number of digits to the right of the decimal. It returns a string representation ...
Read MoreUse HTML with jQuery to make a form
To create forms with HTML and jQuery, you can either write static HTML forms or dynamically generate them using jQuery's DOM manipulation methods. Creating a Static HTML Form The basic approach uses standard HTML form elements: Student Details: Student Name: ...
Read MoreHow to copy text to the clipboard with JavaScript?
To copy text to the clipboard in JavaScript, we can use both modern and legacy approaches. The modern navigator.clipboard API is recommended, while the older document.execCommand() method provides fallback support. Modern Approach: Using navigator.clipboard API The navigator.clipboard.writeText() method is the modern standard for copying text. It returns a Promise and works asynchronously. button { border: none; ...
Read Moreffmpeg settings for converting to mp4 and ogg for HTML5 video
Convert videos to proper formats for HTML5 video on Linux shell using ffmpeg. HTML5 video requires specific codecs for cross-browser compatibility. MP4 with H.264/AAC works in most browsers, while OGV with Theora/Vorbis supports Firefox and other open-source browsers. Converting to MP4 Format When converting to MP4, use the H.264 video codec and AAC audio codec for maximum browser compatibility, especially IE11 and earlier versions. ffmpeg -i input.mov -vcodec h264 -acodec aac -strict -2 output.mp4 This command converts input.mov to output.mp4 with H.264 video and AAC audio codecs. MP4 with Maximum Compatibility ...
Read MoreHidden Bootstrap class
To hide elements in Bootstrap, you can use visibility utility classes. Bootstrap provides several classes to control element visibility across different screen sizes and contexts. Bootstrap Hidden Classes Bootstrap offers different approaches to hide elements: .d-none - Completely removes the element from the document flow .visually-hidden - Hides visually but keeps accessible to screen readers .invisible - Makes element invisible but maintains its space Using .d-none Class The .d-none class completely hides an element by setting display: none: Bootstrap ...
Read MoreAre there any style options for the HTML5 Date picker?
The HTML5 date picker provides a native calendar interface for date selection. While browsers implement their own default styling, you can customize the appearance using CSS pseudo-elements, particularly for WebKit-based browsers like Chrome and Safari. Basic Date Picker Structure The HTML5 date input creates a structured date picker with separate fields for month, day, and year, plus a calendar dropdown indicator. HTML5 Date Picker Styling Basic Date Picker Styling the Date Picker Container ...
Read MoreWhat is the difference between setTimeout() and setInterval() in JavaScript?
JavaScript provides two timing functions: setTimeout() for one-time execution and setInterval() for repeated execution at specified intervals. setTimeout() Function setTimeout(function, delay) executes a function once after a specified delay in milliseconds. Syntax setTimeout(function, delay); setTimeout(callback, delay, param1, param2, ...); Example setTimeout(function() { console.log('This runs once after 2 seconds'); }, 2000); console.log('This runs immediately'); This runs immediately This runs once after 2 seconds setInterval() Function setInterval(function, delay) executes a function repeatedly at specified intervals until ...
Read More