Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <form method="post">
- <label>Enter your name</label>
- <input id="myName" type="text" placeholder="Your name here"><br>
- <label>enter your first name</label>
- <input id="myFirstName" type="text" placeholder="Your first name here"><br>
- <input id="myButton" type="button" value="submit">
- </form>
- <p id="mydisplay"></p>
- <script src="script.js"></script>
- </body>
- function myFunction(){
- var x = document.getElementById("myName").value + "<BR>" + document.getElementById("myFirtName").value ;
- if (x != ""){
- alert("Thank you fill in the fields")
- } else{
- document.getElementById("myDisplay").innerHTML = x;
- }
- }
- window.addEventListener("click", function () {
- document.getElementById("myButton").addEventListener("click", myFunction);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement