radhakrishna

radhakrishna

62 Articles Published

Articles by radhakrishna

Page 2 of 7

What is onkeypress event in JavaScript?

radhakrishna
radhakrishna
Updated on 15-Mar-2026 447 Views

The onkeypress event in JavaScript triggers when a user presses and releases a key while an element has focus. This event is commonly used with input fields, text areas, and other interactive elements to respond to user keyboard input. Syntax element.onkeypress = function(event) { // Handle keypress }; // Or in HTML Basic Example Here's how to use the onkeypress event to detect when a key is pressed in an input field: ...

Read More

Set the font style with CSS

radhakrishna
radhakrishna
Updated on 15-Mar-2026 216 Views

To set the font style, use the font-style property. This CSS property allows you to make text appear italic, normal, or oblique. Syntax font-style: normal | italic | oblique; Values normal - Default font style (upright text) italic - Slanted version of the font (if available) oblique - Artificially slanted text Example: Italic Font Style You can try to run the following code to set the font-style to italic with CSS: Font Style Example ...

Read More

How to set cookies expiry date in JavaScript?

radhakrishna
radhakrishna
Updated on 15-Mar-2026 6K+ Views

Setting an expiration date for cookies allows them to persist beyond the current browser session. Without an expiration date, cookies are deleted when the browser closes. You can set the expiry date using the expires attribute in the cookie string. Syntax document.cookie = "name=value; expires=date; path=/"; Setting Cookie with 1 Month Expiry Here's how to create a cookie that expires after one month: function WriteCookie() { var now = new Date(); ...

Read More

What is super() function in JavaScript?

radhakrishna
radhakrishna
Updated on 15-Mar-2026 333 Views

The super() function in JavaScript is used to call the constructor of the parent class and access methods from the parent class within a child class. It's essential for proper inheritance in ES6 classes. Syntax super() // Call parent constructor super.method() // Call parent method Using super() in Constructor When extending a class, you must call super() before using this in the child constructor: ...

Read More

How to detect if JavaScript is disabled in a browser?

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

To detect if JavaScript is disabled in a web browser, you can use several approaches. The most common method is the HTML tag, which displays content only when JavaScript is unavailable. Using the Tag The tag provides fallback content for browsers that don't support JavaScript or have it disabled: JavaScript Detection document.write("JavaScript is enabled!"); ...

Read More

What is the difference between comments /*...*/ and /**...*/ in JavaScript?

radhakrishna
radhakrishna
Updated on 15-Mar-2026 736 Views

In JavaScript, both /*...*/ and /**...*/ create multi-line comments, but they serve different purposes. The key difference is that /**...*/ is specifically used for documentation comments (JSDoc), while /*...*/ is for regular multi-line comments. Regular Multi-line Comments (/*...*/) Standard multi-line comments are used for general code documentation and explanations: /* * This is a regular multi-line comment * Used for general code explanations * Similar to C-style comments */ function calculateArea(width, height) { return width * height; } JSDoc Documentation Comments (/**...*/) JSDoc comments start ...

Read More

What is the relationship between JavaScript, CoffeeScript, TypeScript, ES5, and ES6?

radhakrishna
radhakrishna
Updated on 15-Mar-2026 240 Views

JavaScript serves as the foundation for web development, with several related languages and versions that enhance or extend its capabilities. Understanding their relationships helps developers choose the right tools for their projects. JavaScript (The Foundation) JavaScript is the core programming language that runs in browsers and Node.js environments. All other languages mentioned either extend JavaScript or compile to it. // Basic JavaScript function greet(name) { return "Hello, " + name + "!"; } console.log(greet("World")); Hello, World! ES5 vs ES6 (JavaScript Versions) ES5 (ECMAScript 5) and ...

Read More

Usage of CSS grid-auto-flow property

radhakrishna
radhakrishna
Updated on 15-Mar-2026 140 Views

The CSS grid-auto-flow property controls how auto-placed items are inserted in the grid container. It determines whether new items are placed in rows or columns and the direction of placement. Syntax selector { grid-auto-flow: value; } Possible Values ValueDescription rowAuto-placed items fill rows first (default) columnAuto-placed items fill columns first row denseFill rows and pack items densely column denseFill columns and pack items densely Example 1: Column Flow The following example uses grid-auto-flow: column to place items in columns − ...

Read More

Animate CSS column-gap property

radhakrishna
radhakrishna
Updated on 15-Mar-2026 628 Views

The CSS column-gap property is used to set the gap between columns in a multi-column layout. When combined with CSS animations, you can create smooth transitions that adjust the spacing between columns over time. Syntax selector { column-gap: value; animation: animation-name duration timing-function iteration-count; } @keyframes animation-name { percentage { column-gap: new-value; } } Example The following example demonstrates how to animate the column-gap property to create a dynamic ...

Read More

Set a delay for the start of an animation with CSS

radhakrishna
radhakrishna
Updated on 15-Mar-2026 209 Views

The CSS animation-delay property is used to set a delay before an animation starts. This property allows you to control when an animation begins, creating staggered effects or waiting for user interactions. Syntax selector { animation-delay: time; } Possible Values ValueDescription timeSpecifies the delay time in seconds (s) or milliseconds (ms) 0Default value - no delay Negative valuesAnimation starts immediately but partway through the animation cycle Example: Basic Animation Delay The following example demonstrates a 2-second delay before the animation starts − ...

Read More
Showing 11–20 of 62 articles
« Prev 1 2 3 4 5 7 Next »
Advertisements