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
| <form> | |
| <input oninput="myfunc(this)" name="foo" id="inp_foo" type="text"> | |
| </form> |
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
| <script> | |
| function myfunc(x = "this") { | |
| var dataValue = x.value; | |
| console.log(dataValue); | |
| } | |
| </script> |
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
| <script> | |
| function myfunc(x = "this") { | |
| var dataValue = x.value; | |
| console.log(dataValue); | |
| } | |
| document.addEventListener('DOMContentLoaded', (event) => { | |
| //Add an Input Event | |
| document.querySelector('#inp_foo').addEventListener('input', function() { | |
| myfunc(this); | |
| }); |
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 checkAnswer(x = "this") { | |
| var answer = 25; | |
| var userAnswer = x.value; | |
| if(userAnswer.length >= 2){ | |
| if(userAnswer != answer) { | |
| alert('You have provided an invalid Answer'); | |
| } | |
| } | |
| } |
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
| <form> | |
| <input id="inp_answer" type="number"> | |
| </form> |
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
| <button id="btn_save" type="button">Save</button> | |
| <form id="form_multi_upload" method="POST"> | |
| <input id="inp_fname" type="text" name="fname"> | |
| <input id="inp_fname" type="text" name="lname"> | |
| <input id="inp_email" type="email" name="email"> | |
| <button id="btn_submit" type="submit">Upload</button> | |
| </form> |
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
| var fnameArry = []; | |
| var lnameArry = []; | |
| var emailArry = []; |
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 saveForm(fname, lname, email) { | |
| //Save form inputs to our Array | |
| fnameArry.push(fname); | |
| lnameArry.push(lname); | |
| emailArry.push(email); | |
| } |
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
| document.addEventListener('DOMContentLoaded', (event) => { | |
| document.querySelector('#btn_save').addEventListener('click', function() { | |
| var fname = document.querySelector('#inp_fname').value; | |
| var lname = document.querySelector('#inp_lname').value; | |
| var email = document.querySelector('#inp_email').value; | |
| saveForm(fname, lname, email); | |
| }); | |
| }) |
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
| $(document).ready(function() { | |
| $('#btn_save').on('click', function(){ | |
| var fname = $('#inp_fname').val(); | |
| var lname = $('#inp_lname').val(); | |
| var email = $('#inp_email').val(); | |
| saveForm(fname, lname, email); | |
| }); | |
| }) |