Articles on Trending Technologies

Technical articles with clear explanations and examples

Execute a script when the window's history changes in HTML?

Srinivas Gorla
Srinivas Gorla
Updated on 16-Mar-2026 261 Views

The onpopstate event in HTML triggers when the browser's history changes, such as when a user clicks the back or forward button. This event is essential for handling navigation in single-page applications and managing browser history programmatically. Syntax Following is the syntax for the onpopstate event − In JavaScript, you can also add the event listener programmatically − window.addEventListener('popstate', functionName); How It Works The onpopstate event fires when the active history entry changes. This happens when users navigate using browser buttons (back/forward) or when history.back(), history.forward(), or history.go() ...

Read More

HTML DOM Input Datetime required Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 215 Views

The HTML DOM Input Datetime required property determines whether a datetime input field must be filled before form submission. When set to true, the browser prevents form submission if the datetime field is empty and displays a validation message. Syntax Following is the syntax for getting the required property − inputDatetimeObject.required Following is the syntax for setting the required property − inputDatetimeObject.required = booleanValue Parameters The required property accepts a boolean value − Value Description true Makes the datetime field mandatory ...

Read More

How to give a limit to the input field in HTML?

Rishi Raj
Rishi Raj
Updated on 16-Mar-2026 6K+ Views

The HTML tag is used to collect user input in web forms. To give a limit to the input field, use the min and max attributes, which specify the minimum and maximum values for an input field respectively. The min and max attributes work with number, range, date, datetime-local, month, time, and week input types. These attributes help validate user input on the client side and provide better user experience by preventing invalid entries. Syntax Following is the syntax for setting input limits using the min and max attributes − For ...

Read More

Execute a script when a mouse button is released over an element in HTML?

radhakrishna
radhakrishna
Updated on 16-Mar-2026 325 Views

When a mouse button is released over an HTML element, the onmouseup event is triggered. This event is commonly used for creating interactive elements that respond to mouse clicks and releases. The onmouseup attribute can be added to any HTML element to execute JavaScript code when the user releases a mouse button while the cursor is over that element. Syntax Following is the syntax for the onmouseup event attribute − Content Where script is the JavaScript code that executes when the mouse button is released over the element. How It Works The ...

Read More

HTML DOM Input Datetime type Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 524 Views

The HTML DOM Input Datetime type property allows you to get or set the type attribute of an input element that was initially created as a datetime input. This property is useful for dynamically changing input types or checking the current type of an input element. Note: The datetime input type has been deprecated in HTML5. Most modern browsers treat it as a text input. For date and time inputs, use datetime-local, date, or time instead. Syntax Following is the syntax for returning the type value − inputDatetimeObject.type Following is the syntax for ...

Read More

How to limit the number of characters allowed in form input text field?

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 70K+ Views

In this article, we will learn how to limit the number of characters allowed in form input text field using HTML attributes. HTML provides built-in attributes to control the character limits in input fields. The maxlength attribute sets the maximum number of characters allowed, while the minlength attribute sets the minimum number of characters required for validation. Syntax Following is the syntax for the maxlength attribute − Following is the syntax for the minlength attribute − Both attributes can be used together to set a character range ...

Read More

Execute a script when the seeking attribute is set to false indicating that seeking has ended in HTML?

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 249 Views

The onseeked attribute in HTML executes a script when the user finishes seeking (jumping to a new position) in an audio or video element. This event fires when the seeking attribute changes from true to false, indicating that the seek operation has completed and the media is ready to play from the new position. Syntax Following is the syntax for the onseeked attribute − Where script is the JavaScript code to execute when seeking ends. How It Works When a user interacts with the video or audio controls to jump ...

Read More

HTML DOM Input Datetime value Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 254 Views

The HTML DOM Input Datetime value property allows you to get or set the value of a datetime input field. This property returns the current value as a string in ISO 8601 format or sets a new datetime value programmatically. Syntax Following is the syntax for getting the datetime value − inputDatetimeObject.value Following is the syntax for setting the datetime value − inputDatetimeObject.value = "YYYY-MM-DDTHH:MM:SSZ" The datetime value must be in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ where T separates date and time, and Z indicates UTC timezone. Return Value ...

Read More

How to limit an HTML input box so that it only accepts numeric input?

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 38K+ Views

In this article, we will learn how to limit an HTML input box so that it only accepts numeric inputs. The most effective way to restrict input to numbers is using . This creates a numeric input field that automatically validates user input and provides built-in controls like spinner buttons. Additionally, we can use attributes like min, max, and step to further control the allowed numeric values. Syntax Following is the basic syntax to create a numeric input field − Following is the syntax with additional attributes for range control − ...

Read More

How do we define the start of a term in a definition list in HTML?

Nikitha N
Nikitha N
Updated on 16-Mar-2026 410 Views

The HTML tag is used to define the start of a term in a definition list. A definition list is similar to other lists but in a definition list, each list item contains two entries: a term and a description. The tag defines the term, while the tag provides its corresponding definition or description. Syntax Following is the syntax for the tag − Term Description of the term The element must be used within a (definition list) container and is ...

Read More
Showing 13961–13970 of 61,298 articles
Advertisements