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
Programming Scripts Articles
Page 5 of 33
What is availHeight property in JavaScript?
The screen.availHeight property returns the available height of the user's screen in pixels, excluding areas occupied by the taskbar, dock, or other system interfaces. Syntax screen.availHeight Return Value Returns a number representing the available screen height in pixels, excluding system UI elements like taskbars. Example Here's how to use the screen.availHeight property to get the available screen height: Screen Available Height ...
Read MoreWhat is the role of special characters in JavaScript Regular Expressions?
Special characters in JavaScript regular expressions are metacharacters that define patterns for matching text. These characters control how many times a character or group should appear and where it should be positioned within a string. Quantifiers Quantifiers specify how many times the preceding character or group should match: Character Description + Matches one or more occurrences of the preceding character * Matches zero or more occurrences of the preceding character ? Matches zero or one occurrence of the preceding character {n} Matches exactly n ...
Read MoreMatch any string containing a sequence of two to three p's.
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 MoreHow to access document properties using W3C DOM method?
The W3C DOM (Document Object Model) provides standardized methods to access and manipulate HTML document properties. Unlike browser-specific approaches, W3C DOM methods work consistently across all modern browsers. Common W3C DOM Methods The most frequently used methods for accessing document properties include: getElementById() - Gets element by its ID attribute getElementsByTagName() - Gets elements by tag name getElementsByClassName() - Gets elements by class name querySelector() - Gets first element matching CSS selector Example: Accessing Document Properties Here's how to access various document properties using W3C DOM methods: ...
Read MoreMatch any single character outside the given set.
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 MoreHow to get the list of document properties which can be accessed using W3C DOM?
The Document Object Model (DOM) provides several key properties that allow you to access and manipulate different parts of an HTML document. These properties are standardized by the W3C and are available across all modern browsers. Core Document Properties Here are the essential document properties you can access using the W3C DOM: Property Description & Example ...
Read MoreHow to return a number indicating the Unicode value of the character?
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 MoreHow to get the innerHTML of a cell with JavaScript DOM?
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 MoreHow can I simplify the usage of Regular Expressions with JavaScript?
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 MoreWith JavaScript DOM delete rows in a table?
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