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
Related Contents:
- Stop form refreshing page on submit
- What is the purpose of Node.js module.exports and how do you use it?
- Convert Data URI to File then append to FormData
- Changing the image source using jQuery
- How can I make console.log show the current state of an object?
- Django Template Variables and Javascript
- How do I hide javascript code in a webpage?
- How to embed fonts in HTML?
- node.js execute system command synchronously
- Is there an easy way to convert jquery code to javascript? [closed]
- How to run function in AngularJS controller on document ready?
- How to parse an RSS feed using JavaScript?
- How to swap two variables in JavaScript
- Finding all indexes of a specified character within a string
- How to invert (transpose) the rows and columns of an HTML table?
- Cross-origin data in HTML5 canvas
- Getting Error 403: Access Not Configured. Please use Google Developers Console to activate the API for your project
- How to trigger click on page load?
- How can I test if a letter in a string is uppercase or lowercase using JavaScript?
- Compare 2 arrays which returns difference
- Get value of input field inside an iframe
- $.each() vs for() loop – and performance
- Get URL from background-image Property
- Downloading Canvas element to an image
- Transforming a Javascript iterable into an array
- Can I reference other properties during object declaration in JavaScript? [duplicate]
- Hot to get the loop counter/index using for…of syntax in JavaScript
- how to exchange variables between two HTML pages?
- Javascript group objects by property [closed]
- download csv file from web api in angular js
- useEffect is running twice on mount in React
- Embedding SVG in PDF (exporting SVG to PDF using JS)
- Is there a way to zoom into a D3 force layout graph?
- Finding DOM node index
- Why doesn’t Node.js have a native DOM?
- Javascript – No ‘Access-Control-Allow-Origin’ header is present on the requested resource
- Hide div element when screen size is smaller than a specific size
- Load multiple files using the d3-fetch module
- QML garbage collection deletes objects still in use
- Nested JSON objects – do I have to use arrays for everything?
- Limit labels number on Chart.js line chart
- In JavaScript, is chained assignment okay?
- Using local file as src
- Saving and loading an image from localStorage
- how to compare two elements in jquery [duplicate]
- How to send multipart/form-data form content by ajax (no jquery)?
- Inspect the names/values of arguments in the definition/execution of a JavaScript function
- Get cursor or text position in pixels for input element
- In ES6, what happens to the arguments in the first call to an iterator’s `next` method?
- ES6 module syntax: is it possible to `export * as Name from …`?