V Jyothi

V Jyothi

54 Articles Published

Articles by V Jyothi

54 articles

How to specify that the audio/video will start over again, every time it is finished in HTML?

V Jyothi
V Jyothi
Updated on 16-Mar-2026 396 Views

Use the loop attribute to specify that the audio/video will start over again every time it is finished. The loop attribute is a boolean attribute that, when present, causes the media to automatically restart from the beginning once it reaches the end. Syntax Following is the syntax for the loop attribute − For audio elements − Using Loop with Video Element The loop attribute works with the HTML5 element to create continuous playback. When the video ...

Read More

Execute a script when the element gets focus in HTML?

V Jyothi
V Jyothi
Updated on 16-Mar-2026 367 Views

The onfocus attribute in HTML executes a JavaScript function when an element receives focus. Focus occurs when a user clicks on an input field, tabs to it using the keyboard, or programmatically selects it. This attribute is commonly used with form elements like input fields, text areas, and select dropdowns. Syntax Following is the syntax for the onfocus attribute − The onfocus attribute accepts a JavaScript function call or inline JavaScript code that executes when the element gains focus. Example − Input Field Focus Following example demonstrates how to change the ...

Read More

How to set what browsers will show that do not support the ruby element?

V Jyothi
V Jyothi
Updated on 16-Mar-2026 192 Views

The HTML tag specifies what browsers will show when they do not support the element. Ruby annotations are used in East Asian typography to provide pronunciation guides or semantic information for characters, commonly seen in Japanese furigana and Chinese pinyin. Syntax Following is the syntax for the tag − base_text fallback_openannotationfallback_close The (ruby parentheses) element contains fallback text that displays in browsers without ruby support. Modern browsers that support ruby annotations hide the content inside tags, while older browsers display it as regular text. ...

Read More

Capitalize text with CSS

V Jyothi
V Jyothi
Updated on 15-Mar-2026 1K+ Views

To capitalize text in CSS, use the text-transform property with the capitalize value. This property transforms the first letter of each word to uppercase while keeping the rest lowercase. Syntax text-transform: capitalize; Basic Example Here's how to capitalize text using CSS: hello world from india Hello World From ...

Read More

Usage of text-align property in CSS

V Jyothi
V Jyothi
Updated on 15-Mar-2026 114 Views

The text-align property in CSS controls the horizontal alignment of text content within its container. It accepts several values to position text left, right, center, or justify it across the available width. Syntax text-align: left | right | center | justify | start | end; Property Values Value Description left Aligns text to the left (default) right Aligns text to the right center Centers text horizontally justify Stretches text to fill the full width Example Here's how to use different ...

Read More

How to allow long and unbreakable words to be broken and wrap to the next line in JavaScript?

V Jyothi
V Jyothi
Updated on 15-Mar-2026 435 Views

Use the wordWrap CSS property in JavaScript to allow long and unbreakable words to be broken and wrap to the next line. This property is especially useful when dealing with long URLs, email addresses, or continuous text that would otherwise overflow their container. Syntax element.style.wordWrap = "break-word"; wordWrap Property Values Value Description normal Default behavior - only ...

Read More

How to add properties and methods to an object in JavaScript?

V Jyothi
V Jyothi
Updated on 15-Mar-2026 306 Views

In JavaScript, you can add properties and methods to objects using several approaches. The most common methods include direct assignment, using the prototype property for constructor functions, and using Object.defineProperty(). Method 1: Direct Property Assignment The simplest way to add properties to an existing object is direct assignment: Direct Property Assignment let car = { brand: "Toyota", ...

Read More

How to define integer constants in JavaScript?

V Jyothi
V Jyothi
Updated on 15-Mar-2026 1K+ Views

ECMAScript allows usage of const to define constants in JavaScript. To define integer constants in JavaScript, use the const keyword. Syntax const CONSTANT_NAME = value; Example const MY_VAL = 5; console.log("MY_VAL:", MY_VAL); // This will throw an error try { MY_VAL = 10; } catch (error) { console.log("Error:", error.message); } MY_VAL: 5 Error: Assignment to constant variable. Key Points As shown above, MY_VAL is a constant with value 5 assigned. Attempting to reassign another value to a constant ...

Read More

How to get Natural logarithm of 10 in JavaScript?

V Jyothi
V Jyothi
Updated on 15-Mar-2026 700 Views

To get the natural logarithm of 10 in JavaScript, use the Math.LN10 property. This built-in constant returns the natural logarithm of 10, which is approximately 2.302585092994046. Syntax Math.LN10 Return Value Returns a number representing the natural logarithm of 10 (ln(10) ≈ 2.302585092994046). Example JavaScript Math LN10 Property ...

Read More

How to define custom JavaScript exceptions?

V Jyothi
V Jyothi
Updated on 15-Mar-2026 228 Views

Custom JavaScript exceptions allow you to create specific error types for your application. You can throw custom error messages or create custom error classes for better error handling. Basic Custom Exception with String The simplest way to create a custom exception is by throwing a string message: function divide(a, b) { try { ...

Read More
Showing 1–10 of 54 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements