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
Articles by Yaswanth Varma
Page 8 of 31
Execute a script when the user pastes some content in an element in HTML?
In this article, we are going to execute a script when the user pastes content into an element in HTML. The onpaste event is triggered when a user pastes content into an element, making it useful for validation, formatting, or tracking paste operations. Although all HTML elements accept the onpaste event, you cannot actually paste content into elements like or unless they have the contenteditable attribute set to "true". Most commonly, the onpaste event is used with elements of type="text" and elements. Syntax Following is the syntax for using the onpaste event in ...
Read MoreExecute a script before the document is printed in HTML?
The onbeforeprint attribute in HTML is an event handler that executes a JavaScript function before a document is printed. This attribute triggers when the user attempts to print the page through browser print functionality (Ctrl+P, File → Print, or print button), displaying custom messages or performing actions before the print dialog appears. The onbeforeprint event is commonly used together with the onafterprint attribute to handle print preparation and cleanup tasks. It belongs to the HTML event attributes category and can be applied to the element or used with JavaScript event listeners. Syntax Following is the syntax ...
Read MoreExecute a script when there have been changes to the anchor part of the URL in HTML?
The onhashchange event in HTML executes a script whenever the anchor part (hash fragment) of the URL changes. The anchor part refers to the portion of the URL that comes after the # symbol, commonly used for navigation within a page or single-page applications. This event is particularly useful for detecting when users navigate using the browser's back/forward buttons or when the URL hash is programmatically modified. The hash change can be detected using either the onhashchange attribute or JavaScript event listeners. Syntax Following is the syntax for the onhashchange attribute − ...
Read MoreHow do we set the type of element in HTML?
In HTML, the type attribute is used to specify the type or behavior of various HTML elements. This attribute is essential for defining how elements should function and what kind of content they handle. The type attribute is commonly used with form elements like and , as well as multimedia and resource elements. The type attribute serves different purposes depending on the element − Form elements − Defines the input type or button behavior Script elements − Specifies the scripting language or MIME type Media elements − Indicates the media format or MIME type Link elements ...
Read MoreHow to add the value of the element in HTML?
The value attribute in HTML specifies the initial or default value for various form elements. It serves different purposes depending on the element type − from setting default text in input fields to defining the data sent when buttons are clicked. Understanding how to properly use the value attribute is essential for creating functional HTML forms. Syntax Following is the basic syntax for using the value attribute − The value attribute can be used with the following HTML elements − − Sets default value for form inputs − Defines ...
Read MoreHow do we display a table cell in HTML
In HTML, table cells are the individual containers that hold data within a table structure. The element defines a standard data cell, while defines header cells. Understanding how to properly display and format table cells is essential for creating organized, accessible data presentations. Syntax Following is the basic syntax for creating table cells − Header Cell Header Cell Data Cell Data Cell ...
Read MoreHow do we display a text area in HTML?
The textarea element in HTML is used to create a multi-line text input control that allows users to enter larger amounts of text. Unlike regular input fields, textareas can display multiple lines of text and are commonly used for comments, descriptions, messages, and other extended text content in forms. The textarea displays text in a fixed-width font (typically Courier) and can hold an unlimited number of characters. It is essential for collecting user feedback, reviews, addresses, and any content that requires more than a single line of text. Syntax Following is the basic syntax for creating a ...
Read MoreHow to create table footer in HTML?
The task we are going to perform in this article is how to create table footer in HTML. As we are familiar with table in HTML, let's have a quick look on it. A table in HTML makes a lot of sense when you want to organize data that would look best in a spreadsheet. A table is a visual representation of rows and columns of data. You may organize data like photos, text, links, and more into rows and columns of cells in HTML by using tables. Syntax Following is the syntax for creating a table ...
Read MoreHow do we include an anchor in HTML?
In this article, we will explore how to include anchors in HTML. An anchor is a fundamental element that creates hyperlinks, enabling navigation between web pages and sections within a page. The anchor element is used to link a source anchor to a destination anchor. The source is the text, image, or button that users click, while the destination is the resource or location being linked to. Hyperlinks are one of the key technologies that make the internet an interconnected information network. Syntax Following is the basic syntax for creating an anchor element − ...
Read MoreImage button with HTML5
In HTML5, we can create image buttons that combine visual images with button functionality. An image button allows users to click on an image to submit forms or trigger JavaScript actions, providing a more visually appealing alternative to standard text buttons. What is an Image Button An image button is a clickable interface element that uses an image instead of text as the button's visual representation. When clicked, it can submit forms, trigger JavaScript functions, or navigate to different pages. There are two main approaches to create image buttons in HTML5 − Using − Creates ...
Read More