document.getElementById (id): Returns the first record matching the id attribute.document.getElementsByName (name): Returns all records matching the name attribute.document.getElementsByTagName: Returns all records that match the tag name as an array.document.getElementsByClassName (className): Returns all records that match the class attribute.document.querySelector: selects the first record that matches the selector.document.querySelectorAll (selector): Return all records matching the selector to the... Continue Reading →
When the button is pressed, the script is loaded(basic code)
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>page</title> </head> <body> <p id="result"></p> <button type="button" id="externalJS">Call JS</button> <script> var getJS = document.getElementById("externalJS"); getJS.onclick = function () { var scriptCreate = document.createElement("script"); scriptCreate.type = "text/javascript"; document.body.appendChild(scriptCreate); } </script> </body> </html> BEFORE AFTER
Simple Collection Process Code (JavaScript)
Simple Collection Process Code (JavaScript)