You have mentioned Wrong id
alert(document.getElementById("name").value);
if you want to use name
attribute then
alert(document.getElementsByName("username")[0].value);
Updates:
input type="text" id="name" name="username"
id is different from name
More Related Contents:
- what all the main differences in cordova and phonegap [closed]
- contenteditable change events
- No visible cause for “Unexpected token ILLEGAL”
- Set keyboard caret position in html textbox
- No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘…’ is therefore not allowed access
- How do I include a JavaScript script file in Angular and call a function from that script?
- How should I call 3 functions in order to execute them one after the other?
- How to copy static files to build directory with Webpack?
- How to get evaluated attributes inside a custom directive
- JavaScript Chart Library
- How to Use Sockets in JavaScript\HTML? [closed]
- How can d3.transform be used in d3 v4?
- Cannot set property ‘innerHTML’ of null
- Get selected text position and place an element next to it
- How to only get new data without existing data from a Firebase?
- In protractor, browser.isElementPresent vs element.isPresent vs element.isElementPresent
- HTML book-like pagination
- Inlining ECMAScript Modules in HTML
- .setAttribute(“disabled”, false); changes editable attribute to false
- hide scrollbar and show on hover like facebook’s new chat sidebar [closed]
- How to find and call javascript method from vba
- Save to Local File from Blob
- Why does sorting a JS array of numbers with < work?
- Creating a (ES6) promise without starting to resolve it
- How to check for broken images in React JS
- Call setTimeout without delay
- how to use addHTML function in jsPDF
- How to use a return value in another function in Javascript?
- When or who does pass resolve and reject functions to JS promises?
- True Isometric Projection with HTML5 Canvas