Its syntax is:
The anchor_name argument passed into the method anchor() is placed in the "NAME" attribute of the html anchor. In the given example, we have created a function display() and called the anchor() method on a String object. We have created a button which calls the function display() from the script and creates an html anchor by adding an anchor to the string specified .
Here is the code:
var txt="Hello world!";
<h2>Use of anchor() method</h2>
Use of Anchor method
Output will be displayed as:
On clicking the button, you will see that the HTML anchor is created. This is shown in the alert box.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.