![]() |
VOOZH | about |
The JavaScriptanchor() method creates an anchor element that is used as a hypertext target that means when you use the anchor method in JavaScript the anchor method returns <a> elements with string and also returns "anchorname" as the value of "name" attribute like this:
<a name=anchorname>string</a>
string.anchor(anchorname)Note: This method has been DEPRECATED and is no longer recommended.
This method accepts a single parameter.
The anchor() method returns the string with <a> element.
Example 1: This example shows the basic use of the anchor tag in Javascript.
<a name="anchorname">GFG</a>
Example 2: This example shows you how to use anchor() method.
<a name="anchorname">GeeksForGeeks</a>