HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <a>Learn jQuery</a> <p>Click on the button to set 'href' for the above anchor tag.</p> <button onclick="myFunction()">Click Me</button> <script> var elem = document.getElementsByTagName("a")[0]; function myFunction(){ elem.setAttribute("href", "/jquery") } </script> </body> </html>
OUTPUT
×

Save as Private