

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the number of anchors with JavaScript?
To get the number of anchors, use the anchors property.
Example
You can try to run the following code to get the number of anchors with JavaScript −
<!DOCTYPE html> <html> <body> <a href="https://www.tutorialspoint.com/php" name="PHP">PHP</a> <br> <a href="https://www.tutorialspoint.com/java/" name="Java">Java</a> <br> <a href="https://www.tutorialspoint.com/html5/" name="HTML5">HTML</a> <br> <a href="https://www.tutorialspoint.com/css/" name="CSS">CSS</a> <script> var val = document.anchors.length; document.write("<br>Number of anchors in the document: "+val); </script> </body> </html>
- Related Questions & Answers
- How to find a number of anchors in a document in JavaScript?
- How to find the coordinates of the cursor with JavaScript?
- How to find the cube root of a number in JavaScript?
- How to find the value of a button with JavaScript?
- How to find the number of links in a document in JavaScript?
- How regular expression anchors work in Python?
- How to find the coordinates of the cursor relative to the screen with JavaScript?
- How to get the number of options in the dropdown list with JavaScript?
- How to return the number of images in a document with JavaScript?
- How to get the number of forms in a document with JavaScript?
- How to show the number of links in a document with JavaScript?
- How to create permutation of array with the given number of elements in JavaScript
- How to find the largest number contained in a JavaScript array?
- With JavaScript how can I find the name of the web browser, with version?
- How to find the name of the first form in a document with JavaScript?
Advertisements