How to get the input from the user in JavaScript | SoloLearn: Learn to code for FREE!

0

How to get the input from the user in JavaScript

2/21/2017 8:24:30 AM

Mallika Balla

2 Answers

New Answer

+3

Prompt() second parameters isn't for title, but for default value ^^ Anyway, this is the easiest way, but the worst also, as it isn't user friendly at all... The right way, is to not be too much lazy, and write at least minimalistic html with an <input type="text">, from where you get the user entry by accessing its 'value' attribute... and eventually an <input type="button"> to call the fuction requiering the user entry ;)

0

var user_name = prompt("Enter your name: ")