Created
February 21, 2018 13:30
-
-
Save iconte/9341934f08c9655f06d7c6688573d681 to your computer and use it in GitHub Desktop.
criar link dom js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function crialink(text, url){ | |
var a = document.createElement("a"); | |
var href = document.createAttribute("href"); | |
href.value = url; | |
var label = document.createTextNode(text); | |
a.appendChild(label); | |
a.setAttributeNode(href); | |
return a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment