HTML Articles

Page 122 of 151

Match any string containing a sequence of two to three p's.

Akshaya Akki
Akshaya Akki
Updated on 15-Mar-2026 153 Views

To match any string containing a sequence of two to three p's with JavaScript RegExp, use the p{2, 3} quantifier. This pattern matches exactly 2 or 3 consecutive occurrences of the letter "p". Syntax /p{2, 3}/flags Where {2, 3} specifies the minimum (2) and maximum (3) number of consecutive p's to match. Example: Matching 2-3 Consecutive p's JavaScript Regular Expression var str = "apple pepper hippopotamus p programming"; ...

Read More

How to get the innerHTML of a cell with JavaScript DOM?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 8K+ Views

In this tutorial, we will learn how to get the innerHTML of a cell with JavaScript DOM. The innerHTML property allows us to access the HTML content inside table cells by first accessing the table structure through the DOM. We can manipulate the DOM (Document Object Model) easily using document.getElementById(). This method returns the element object that represents the element whose id is specified in the parameter. Since every element's id is unique, we can easily access specific table elements and then use the innerHTML property to retrieve the content of table cells. Using Table Cells Collection ...

Read More

How can I simplify the usage of Regular Expressions with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 388 Views

In this tutorial, we will learn to simplify the use of regular expressions in JavaScript. Regular expressions, also called Regex or RegExp, are sequences of characters that define search patterns. They can be simple or complex and work across many programming languages. Let's understand the need for regular expressions with a practical example. Why Should We Use Regular Expressions? Suppose you're developing an application that collects user emails. Users can enter anything in the input field, potentially creating spam records in your database. You need to validate emails before form submission. To validate an email, you ...

Read More

With JavaScript DOM delete rows in a table?

Sharon Christine
Sharon Christine
Updated on 15-Mar-2026 6K+ Views

To delete rows in a table in JavaScript, use the DOM deleteRow() method. This method removes a row from a table by specifying its index position. Syntax table.deleteRow(index) Parameters The index parameter specifies which row to delete (0-based indexing). Use -1 to delete the last row. Example: Delete Rows One by One The following example shows how to delete table rows. Each click removes the first row: function deleteFirstRow() { ...

Read More

Match any single character outside the given set.

Rama Giri
Rama Giri
Updated on 15-Mar-2026 144 Views

To match any single character outside the given set with JavaScript RegExp, use the [^...] metacharacter. The caret ^ inside square brackets creates a negated character class that matches any character NOT in the specified set. Syntax /[^characters]/flags Where characters are the characters you want to exclude from matching. Example: Matching Characters Outside a Set JavaScript Regular Expression var myStr = "Welcome!"; var ...

Read More

How to check whether a value is a safe integer or not in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 700 Views

In this tutorial, we will learn to check whether a value is a safe integer or not in JavaScript. A safe integer in JavaScript is any number that can be accurately represented under the IEEE-754 double-precision format. Safe integers are all numbers between -(2^53 - 1) and (2^53 - 1) inclusive. JavaScript provides a built-in method for this check, but we can also implement custom logic. Here are the approaches we'll explore: Using the Number.isSafeInteger() Method (Recommended) Using Custom if-else Logic Using Number.isSafeInteger() Method The Number.isSafeInteger() ...

Read More

How to convert Unicode values to characters in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 6K+ Views

In this tutorial, we will learn to convert Unicode values to characters in JavaScript. The Unicode values are the standard values for the character, and users can encode them to convert them into characters. For example, 'A' is a Unicode character whose value is 65 according to the ASCII (American standard code for information interchange) table. In the same way, all alphabets, numbers, and other characters have particular Unicode values. We will learn to identify the Unicode character from its values using JavaScript. Using the fromCharCode() Method In JavaScript, the String object contains the fromCharCode() method, which ...

Read More

For Hosts Locale how to convert a string to lowercase letters in JavaScript?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 201 Views

To convert a string to lowercase letters in JavaScript, use the toLocaleLowerCase() method. This method converts characters to lowercase according to the host's locale, making it ideal for international applications. Syntax string.toLocaleLowerCase([locale]) Parameters locale (optional): A string specifying the locale to use for conversion. If omitted, the host environment's current locale is used. Basic Example Here's how to use toLocaleLowerCase() to convert a string to lowercase: var str ...

Read More

How to return a number indicating the Unicode value of the character?

Alankritha Ammu
Alankritha Ammu
Updated on 15-Mar-2026 421 Views

The charCodeAt() method returns a number indicating the Unicode value of the character at the given index. Unicode code points range from 0 to 1, 114, 111. The first 128 Unicode code points are a direct match of the ASCII character encoding. Syntax string.charCodeAt(index) Parameters index − An integer between 0 and 1 less than the length of the string; if unspecified, defaults to 0. Return Value Returns a number representing the Unicode code point of the character at the specified index. If the index is ...

Read More

What is the role of pageXOffset property in JavaScript?

Samual Sam
Samual Sam
Updated on 15-Mar-2026 302 Views

The pageXOffset property returns the number of pixels the document has been scrolled horizontally from the left edge of the window. It's a read-only property of the window object used to track horizontal scroll position. Syntax let horizontalScroll = window.pageXOffset; Return Value Returns a number representing the horizontal scroll position in pixels. Returns 0 if the document hasn't been scrolled horizontally. Example: Basic Usage div { ...

Read More
Showing 1211–1220 of 1,509 articles
« Prev 1 120 121 122 123 124 151 Next »
Advertisements