HTML Articles

Page 119 of 151

How do I export my HTML page as a PDF using JavaScript?

Ayush Singh
Ayush Singh
Updated on 15-Mar-2026 15K+ Views

Converting HTML pages to PDF using JavaScript is a common requirement for web applications. Two popular libraries make this possible: jsPDF and html2pdf.js. These tools allow you to generate PDFs client-side, giving users downloadable documents from your web content. Available Methods jsPDF - More control over PDF creation with manual content addition html2pdf.js - Automatic HTML-to-PDF conversion with minimal setup Using jsPDF jsPDF provides fine-grained control over PDF creation. You manually add content using its API methods, making it suitable when you need precise formatting and layout control. Basic jsPDF Example ...

Read More

How do you write a Javascript code on the HTML page?

Ayush Singh
Ayush Singh
Updated on 15-Mar-2026 824 Views

Integrating JavaScript with HTML is essential for creating dynamic and interactive web pages. While HTML provides structure, JavaScript adds behavior and interactivity that transforms static pages into engaging user experiences. There are two primary methods to include JavaScript in HTML pages: inline scripts (embedded directly in HTML) and external scripts (linked from separate files). JavaScript Basics Before integrating JavaScript into HTML, understanding basic JavaScript concepts is crucial: Variables and Data Types let name = 'Arya'; const age = 25; var isActive = true; console.log(name); console.log(age); console.log(isActive); Arya 25 true ...

Read More

How to Randomly Change Image Color using HTML CSS and JavaScript ?

Eesha Gandhi
Eesha Gandhi
Updated on 15-Mar-2026 1K+ Views

In this tutorial, we will explore two approaches to randomly change image color using HTML, CSS and JavaScript. We'll use CSS blend modes and background color techniques to create dynamic color effects. Approach 1: Using Math.random() with CSS Mix-Blend-Mode This approach uses the CSS mix-blend-mode property combined with a colored overlay to change the image appearance. We'll generate random RGB colors using JavaScript's Math.random() function. How It Works The mix-blend-mode: hue property blends the background color of an overlay div with the underlying image, creating a color-tinted effect. When we change the overlay's background color randomly, ...

Read More

How to Change a Button Text on Click Using LocalStorage in Javascript?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 575 Views

JavaScript provides powerful tools to create interactive web pages. In this article, we'll learn how to change a button's text when clicked and persist that change using localStorage, so the new text remains even after refreshing the page. What is localStorage? The localStorage is a read-only property of the window interface that allows you to store data permanently in the user's browser. Unlike sessionStorage, data stored in localStorage persists even when the browser session ends, making it perfect for remembering user preferences. localStorage Methods localStorage provides two essential methods for data manipulation: Getting Data ...

Read More

How to Change an HTML Element Name Using jQuery?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 1K+ Views

jQuery is a JavaScript library created to make event handling, CSS animation, Ajax, and DOM tree navigation and manipulation easier. In this article we are going to see how we can change the name of an element using jQuery. Algorithm We are going to follow a three−way procedure to change the name of any element using jQuery: Identify and select the element we want to change. Copy all the attributes of the selected element to a temporary object. Create a new element with the ...

Read More

Creating A Range Slider In HTML using JavaScript

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 1K+ Views

On web pages, range sliders are used to let users specify a numeric value within a defined range. Instead of typing exact numbers, users can simply drag a slider control to select their desired value. This makes range sliders perfect for settings where precision isn't critical, such as volume controls, brightness adjustments, or filtering options. HTML provides the element for creating basic sliders, but with JavaScript and CSS, we can enhance them to create more interactive and visually appealing controls. HTML input type="range" The creates a slider control for selecting numeric values. By default, it ...

Read More

How to add fade-in effect using pure JavaScript?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 7K+ Views

Introduction We use the fade effect to bring attention to certain parts of our website by gradually increasing or decreasing their opacity. This gradual change in opacity is called the fade-in or fade-out effect. When we gradually increase the opacity, it's known as the fade-in effect and is used to make the selected part of the page become more visible over a chosen amount of time. This creates a smooth transition and helps make our website more dynamic and engaging for our users. In this article, we will be exploring two ways in which we can implement the ...

Read More

How does inline JavaScript work with HTML?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 7K+ Views

In this article, you will understand how inline JavaScript works with HTML. Inline JavaScript represents a code block written in between the tags in an HTML file. The advantage of using inline JavaScript in HTML files is to reduce the round trip of the web browser to the server. What is Inline JavaScript? Inline JavaScript is JavaScript code that is embedded directly within HTML documents using tags. This approach allows you to execute JavaScript without creating separate .js files, making it convenient for small scripts and quick implementations. Example 1: Basic Inline JavaScript Let ...

Read More

How to show images with a click in JavaScript using HTML?

Kalyan Mishra
Kalyan Mishra
Updated on 15-Mar-2026 38K+ Views

To display images on click using JavaScript and HTML, you can create hidden images, add click events, and reveal images dynamically for an interactive user experience. This technique enhances user engagement and improves page load times by showing content only when needed. Users often want to create interactive web pages where images are initially hidden and can be revealed with a click. The challenge is implementing this functionality using JavaScript and HTML in a simple and efficient manner. Approaches to Show Images with a Click Using the Style Display Property Using ...

Read More

How to create a table caption with JavaScript DOM?

Jai Janardhan
Jai Janardhan
Updated on 15-Mar-2026 665 Views

To create a table caption using JavaScript DOM, use the createCaption() method on a table element. This method adds a element to the table, which displays as a title above the table content. Syntax table.createCaption() Return Value Returns the newly created element, which can be styled or modified with text content. Example Here's how to create a table caption dynamically using JavaScript: function captionFunc(x) { ...

Read More
Showing 1181–1190 of 1,509 articles
« Prev 1 117 118 119 120 121 151 Next »
Advertisements