how to ask input in javascript
let name=prompt("What is your name?");
console.log("Hi "+name)Copyvar name = window.prompt("Enter your name: ");
alert("Your name is " + name);Input Text Object
The Input Text object represents an HTML <input> element with type="text".
Access an Input Text Object
You can access an <input> element with type="text" by using getElementById():
Example
var x = document.getElementById("myText");
Tip: You can also access <input type="text"> by searching through the elements collection of a form.
Create an Input Text Object
You can create an <input> element with type="text" by using the document.createElement() method:
Example
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
Also in JavaScript:
- infinite scroll javascript
- how to make a javascript game
- compare two arrays and make sure there are no duplicates js
- handleClick react
- trim white spaces in js
- send audio with socket io node js
- get image center pixels nodejs
- advanced axios in react js using create and interceptor
- Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json' or set 'CircuitOptions.DetailedErrors'.
- bookshelf insert multiple rows
- Javascript remove last character
- moment add 30 days
- javascript add query string to url
- classic asp get json from url
- vue js data bind
- generate thumbnail of pdf using pf js
- js open link onmouseup
- how to place a line break in react native
- javascript ...
- how to decode apollo client graphql error: bad request
- javascript console.table
- javascript abs
- moment parse string to date
- downcasting js