How to accept JavaScript USER INPUT in 5 minutes

10 Views
Published
00:00:00 intro
00:00:19 window prompt
00:01:36 HTML textbox

// How to accept user input

// 1. EASY WAY = window prompt
// 2. PROFESSIONAL WAY = HTML textbox

// ------------------------- EASY WAY -------------------------
// let username = window.prompt("What's your username?");

// console.log(username);

// --------------------- PROFESSIONAL WAY ---------------------
let username;

document.getElementById("mySubmit").onclick = function(){
username = document.getElementById("myText").value;
document.getElementById("myH1").textContent = `Hello ${username}`
}
Category
Bro Code
Tags
javascript, javascript tutorial, javascript full course
Be the first to comment