Created
May 15, 2020 22:10
-
-
Save kingluddite/0b4cf305aac05aa1eebb857270370ba0 to your computer and use it in GitHub Desktop.
dynamic jquery elements
This file contains 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
$(document).ready(function() { | |
console.log("click code works!"); | |
var root = document.querySelector("#empty-area"); | |
root.innerHTML = | |
"<button id='name-btn'>Click to see my name</button><div id='name'></div>"; | |
$("#empty-area").on("click", "#name-btn", function() { | |
console.log("test"); | |
$("#name").html("John Jacob Jingleheimer-Schmidt"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment