Found 9053 Articles for Front End Technology

How to find the number of anchors with JavaScript?

Abhishek
Updated on 31-Oct-2022 08:03:31

116 Views

In this tutorial, we will learn how to find the number of anchors used in an HTML document with JavaScript. Sometimes, During the development of a web page, the developer may need to add multiple links to the different buttons present on the webpage using multiple anchors for each button. In such a situation, if you want to find the number of anchor elements, you can use the anchors property. JavaScript allows us to use the anchors property to count the number of anchors ( elements) in an HTML document. Note − The document.anchors property is deprecated and no longer ... Read More

How to show the number of links in a document with JavaScript?

Abhishek Kumar
Updated on 21-Sep-2022 07:58:03

525 Views

We use the links property of the document object to show the number of links in a document with JavaScript. The document object, part of the DOM, corresponds to the current web page that the browser has loaded. It Contains all the information about the condition of the browser as well as the web page. The links is a property of the document object that returns a list of all the hyperlinks present in the HTML document. A hyperlink may look something like this − "https://www.tutorialpoints.com/php" The links property of the document object lists all HTML elements having href ... Read More

How to get the number of forms in a document with JavaScript?

Shubham Vora
Updated on 14-Sep-2022 08:47:27

804 Views

In this tutorial, we will learn how to get the number of forms in a document using JavaScript. Since different methods are used to create forms in an HTML document, it might get tricky to get the number of forms present. However, you can use some methods to count the forms created without the form tag. Using the length Property The most widely accepted method to create forms in HTML documents is using the tag. Some websites also use tags to create forms in the document. Hence, we will discuss the method to get the number of forms ... Read More

How to load the previous URL in the history list in JavaScript?

Shubham Vora
Updated on 14-Sep-2022 13:33:47

5K+ Views

In this tutorial, we will learn to load the previous page in the history list in JavaScript. The Window object in JavaScript accesses the window in the browser. This object contains many properties and methods required to do the tasks. The Window object also retrieves the information from the browser window. There is a history stack in every browser that saves the pages visited by the user. To access this history stack, we can use the history object that is the property of the Window object. By accessing the history from the browser, we can go to the next or ... Read More

How to load the next URL in the history list in JavaScript?

Shubham Vora
Updated on 14-Sep-2022 13:31:40

575 Views

In this tutorial, we will learn to load the next page in the history list in JavaScript. The Window object in JavaScript accesses the window in the browser. This object contains many properties and methods required to do the tasks. The Window object also retrieves the information from the browser window. There is a history stack in every browser that saves the pages visited by the user. To access this history stack, we can use the history object that is the property of the Window object. By accessing the history from the browser, we can go to the next or ... Read More

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

Shubham Vora
Updated on 15-Nov-2022 08:08:31

181 Views

In this tutorial, we will learn how to convert a string to uppercase letters for the host's locale in JavaScript. While using a locale language to write for a website, we might have to convert the sentence from lowercase to uppercase without changing the structure of the string. Using the toLocaleUpperCase() Method In JavaScript, we use the toUpperCase() Method as well as the toLocaleUpperCase() to change the letters of a string to uppercase. Although both methods give similar output the toLocaleUpperCase() is used primarily for local languages. Syntax We will use the following syntax to convert the letters of the ... Read More

Find a form feed character with JavaScript RegExp.

Sravani Alamanda
Updated on 26-Aug-2022 12:52:29

810 Views

Form feed character is page breaking ASCII control character. It is commonly used for page separators. When you want to insert a page break, the text editor can use this form feed. It is defined as \f and has an ASCII code value as 12 or 0x0c. RegExp is an object that specifies the pattern used to do a search and replace operations on a string or for input validation. RegExp was introduced in ES1, and it is fully supported by all browsers. Now, we will check how to find the form feed (\f) character in the given text using ... Read More

Find a new line character with JavaScript RegExp.

Sravani Alamanda
Updated on 26-Aug-2022 12:55:22

3K+ Views

The new line character, we denote as . This is used to make a line break. ASCII code for is 10 and it is also called Line Feed (LF). Now, let's see how to find a new line character using RegExp. A RegExp is an object that specifies the pattern used to do search and replace operations on the string or for input validation. RegExp was introduced in ES1 and it is fully supported by all browsers The RegExp meta character finds an index value of the first occurrence of a newline character in a given text. Syntax ... Read More

How to compare two strings in the current locale with JavaScript?

Shubham Vora
Updated on 17-Aug-2022 08:16:00

462 Views

In this tutorial, we will learn to compare two strings in a current locale with JavaScript. The meaning of the locale is local place or region. Here, we need to compare two strings based on the language of the particular locale. Normally, when users compare the strings using equality or strict equality operators, it doesn’t compare strings based on the current locale. So, we will learn to compare the two strings based on the language of the particular locale. Compare two strings using the localeCompare() Method The String localeCompare() method compares the string with the reference string according to the ... Read More

How to return a new string with a specified number of copies of an existing string with JavaScript?

Prabhdeep Singh
Updated on 07-Nov-2022 06:40:02

126 Views

In this tutorial, we will explore the methods by which we can repeat a string a certain number of times, again and again, to make a new string in JavaScript. There are many scenarios where we may want to make a new string which is just another string repeated ‘x’ number of times and we will see how to achieve that easily using inbuilt methods provided by JavaScript. We want to create a new string which is just another string copied some number of times. Although we can accomplish this task manually by using a for loop or a while ... Read More

Advertisements