Javascript Articles

Page 53 of 534

Explain Asynchronous vs Deferred JavaScript

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 403 Views

When loading JavaScript files, the browser normally pauses HTML parsing to download and execute scripts. This can slow down page loading, especially with large JavaScript files. The async and defer attributes solve this problem by changing how scripts are loaded and executed. Normal Script Loading By default, scripts block HTML parsing until they finish downloading and executing: The browser stops parsing HTML, downloads the script, executes it, then continues parsing. This can create delays, especially with large scripts. Async Attribute The async attribute downloads scripts in parallel with HTML parsing. Once ...

Read More

How can JavaScript code be hidden from old browsers that do not support JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 677 Views

The JavaScript script tag is occasionally not understood by older browsers. If not, they will simply disregard it and display your script as though it were a section of the (X)HTML document's body. It's a smart option to use comments to hide scripts from outdated browsers to prevent it from happening. JavaScript is now supported by all modern browsers; however, earlier browsers did not. In this article, we'll learn how to prevent JavaScript code from executing in older browsers. As some of your viewers will be seeing the site on a phone while others are using a large ...

Read More

How do I shift from jQuery to core JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 248 Views

JavaScript is a versatile programming language used to create interactive and dynamic web applications. While jQuery was once essential for simplifying JavaScript development, modern JavaScript (ES6+) now provides native methods that make jQuery less necessary. jQuery is a lightweight JavaScript library that simplifies DOM manipulation, event handling, and AJAX operations. It became popular because it solved cross-browser compatibility issues and provided a simpler syntax for common tasks. Why Developers are Moving from jQuery to Vanilla JavaScript Modern JavaScript Features: ES6+ provides powerful built-in methods that eliminate the need for jQuery's utility functions. ...

Read More

How to create editable div using JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 2K+ Views

In this tutorial, you'll learn how to create editable div elements using JavaScript. An editable div allows users to click and modify text content directly in the browser, providing an intuitive inline editing experience. Method 1: Using contentEditable Property The simplest approach is using the HTML5 contentEditable attribute, which makes any element editable when set to true. Editable Div with contentEditable .editable-div { border: ...

Read More

How to detect copy paste commands Ctrl+V, Ctrl+C using JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 4K+ Views

You'll learn how to use JavaScript to detect the keystrokes Ctrl+V and Ctrl+C in this article. When a user wishes to paste something into an input field, they have two options: either they can use the context menu by right-clicking on the webpage or they may use their keyboard by pressing the CTRL and V buttons simultaneously. The keydown event's ctrlKey property is used to figure out the key combination that contains "Ctrl." To identify whether "ctrl" is pressed or not during the key event, it produces a "boolean" value. Syntax event.ctrlKey Return Value ...

Read More

How to prevent sticky hover effects for buttons on touch devices?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 2K+ Views

Touch devices often exhibit "sticky" hover effects where buttons remain in their hovered state after being tapped. This creates a poor user experience as the visual feedback doesn't match the intended interaction model of touch interfaces. The Problem with Hover on Touch Devices Touch screens don't have true hover capabilities, but many browsers simulate hover events when elements are touched. This causes several issues: Elements may remain in their hovered state after being tapped, creating a "sticky" effect On iOS devices, the hover state briefly appears before navigation, causing visual flicker Hover effects that show/hide elements ...

Read More

How to import a SVG file in JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 6K+ Views

Scalable Vector Graphic (SVG) is a powerful 2D image format that uses mathematical formulas and XML markup to create scalable graphics. Unlike raster images (JPEG, PNG) that rely on pixels, SVG files maintain crisp quality at any size, making them ideal for web development. SVG files offer significant advantages in web design including infinite scalability, smaller file sizes, better accessibility features, and the ability to be styled with CSS. This article explores different methods to import and use SVG files in JavaScript applications. Method 1: Using HTML Element The simplest method to display SVG files is ...

Read More

Implement Green Screen Algorithm using JavaScript

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 1K+ Views

The green screen algorithm, also known as the chromakey algorithm, replaces all green pixels in a foreground image with corresponding pixels from a background image. This technique is widely used in film and video production to composite subjects against different backgrounds. The algorithm works by analyzing each pixel's color values. When a pixel has more green than red and blue combined, it's considered part of the green screen and gets replaced with the corresponding pixel from the background image. Requirements This implementation uses the SimpleImage library for image manipulation. Include this script in your HTML: ...

Read More

Target a Window Using JavaScript or HTML

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 3K+ Views

In this article we will learn how to use the TARGET attribute to open a website in a new window using HTML and JavaScript. TARGET attribute of HTML A link's opening named frame or window is specified using the Target attribute of the anchor tag. The concluding tag in the HTML content must appear after each commencing tag since the element is paired. Although the href (hypertext reference) element of the anchor tag has several other options, it is required since it contains the URL of the webpage where the link will go when ...

Read More

Unit Testing Challenges with Modular JavaScript Patterns

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 414 Views

Unit testing is a crucial automated testing technique that isolates and tests small portions of your application. Unlike integration tests, unit tests don't connect to external dependencies like databases or HTTP services, making them faster and more reliable. This "full isolation" approach ensures tests won't fail due to external service issues. However, when working with modular JavaScript patterns, unit testing presents unique challenges. Modules help organize code by keeping units cleanly separated, but their encapsulation features can make testing private methods and variables difficult. JavaScript Module Patterns Overview JavaScript modules (also called ES modules or ECMAScript modules) ...

Read More
Showing 521–530 of 5,340 articles
« Prev 1 51 52 53 54 55 534 Next »
Advertisements