Javascript examples for String:anchor
The anchor() method is used to create an HTML anchor.
This method returns the string embedded in the <a> tag, like this: <a name="anchorname">string</a>
Parameter | Description |
---|---|
name | Required. The name of the anchor |
A string embedded in the <a> tag
The following code shows how to Create an HTML anchor around a string:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {// w w w .j a v a 2s . c o m var txt = "test"; txt.anchor("anchor link"); console.log(txt.anchor("chap10")); } </script> </body> </html>