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
Object Oriented Programming Articles
Page 74 of 589
How to set the CSS property that the transition effect is for with JavaScript?
Use the transitionProperty property in JavaScript to set which CSS properties should have transition effects. This property controls exactly which CSS properties will animate when they change. Syntax element.style.transitionProperty = "property1, property2, ..."; element.style.transitionProperty = "all"; // All properties element.style.transitionProperty = "none"; // No transitions Example Here's a complete example showing how to set transition properties dynamically: #div1 { ...
Read MoreHow to handle tabs, line breaks and whitespace in a text in JavaScript?
In this tutorial, we will learn how to handle tabs, line breaks, and whitespace in text using JavaScript's CSS white-space property. JavaScript provides control over text formatting through the style.whiteSpace property. This property has several values that determine how whitespace is handled: normal - Default value; collapses multiple spaces into one, wraps text automatically pre - Preserves spaces and tabs, respects line breaks pre-wrap - Like 'pre' but also wraps long lines pre-line - Preserves line breaks but collapses spaces ...
Read MoreHow to set line breaking rules for non-CJK scripts in JavaScript?
The word-break CSS property controls how words break when text overflows its container. For non-CJK (Chinese, Japanese, Korean) scripts like English, you can set different line breaking behaviors using JavaScript. Syntax element.style.wordBreak = "value"; word-break Property Values Value Description Use Case normal Default breaking rules Standard text flow break-all Break anywhere, even mid-word Prevent overflow in narrow containers keep-all Don't break CJK text Preserve CJK word integrity Example: Interactive Word Breaking ...
Read MoreWebGL: Prevent color buffer from being cleared in HTML5
In WebGL, the color buffer is automatically cleared at the beginning of each frame by default. This can be problematic when you want to preserve previous drawings for effects like trails or persistent graphics. The Problem Even when you manually clear the color buffer using clearColor() and clear(), the WebGL context automatically clears the drawing buffer before the next frame: // Manual clearing - but buffer still gets cleared automatically gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); This automatic clearing happens at the beginning of the next draw cycle, making it impossible to build up graphics ...
Read MoreHow to set the spacing between words in a text in JavaScript?
In this article, we will learn how to set the spacing between words in a text using JavaScript. Word spacing is critical on websites because it improves the legibility and readability of the text displayed on the page. You can generate an aesthetically pleasing and easy-to-read typeface using proper word spacing. In JavaScript, we use the wordSpacing property to set the spacing between the words in a text displayed on a website. Using the Style wordSpacing Property This JavaScript DOM property is used to get and set the spacing between the words in a text. You ...
Read MoreHow to allow long and unbreakable words to be broken and wrap to the next line in JavaScript?
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 MoreHow to print content of JavaScript object?
In this tutorial, we will learn to print the content of a JavaScript object. Objects are similar to variables, but they can contain many values. Javascript object values are written as key: value pairs, and each pair is separated by commas. It is used to access data from databases or any other sources. Following are the ways to print the content of JavaScript objects − Using the JSON.stringify() Method Using Object.values() Using a for-in loop Using JSON.stringify() Method The JSON.stringify() method converts JavaScript objects ...
Read MoreHow to replace all dots in a string using JavaScript?
In this tutorial, we will explore different ways to replace all dots in a string using JavaScript. While it's possible to remove all occurrences of dots manually with a for loop, JavaScript provides built-in methods that make this task much simpler. The two most popular methods for replacing all dots in a string are: Using the replaceAll() Method The replaceAll() method replaces all occurrences of a specified pattern with a replacement string. This is the most straightforward approach for replacing all dots. Syntax string.replaceAll(searchValue, replaceValue) Parameters searchValue ...
Read MoreHow to display HTML element with JavaScript?
In this tutorial, we will learn how to display an HTML element using JavaScript. HTML elements are the components that make up an HTML format file. These components are in charge of constructing web pages and defining their content. In HTML, an element typically consists of a start tag, content, and a closing tag. Some HTML elements are − Starting Tag Content Ending Tag ...
Read MoreIs their a JavaScript Equivalent to PHP explode()?
The JavaScript equivalent to PHP's explode() function is split(). Both functions break a string into an array based on a specified delimiter. Syntax string.split(separator, limit) Parameters separator: The character or string to split by (required) limit: Maximum number of splits (optional) Basic Example JavaScript split() Example var str = '087000764008:Rank:info:result'; var arr = str.split(":"); ...
Read More