5 examples of 'javascript get input by name' in JavaScript

Every line of 'javascript get input by name' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
376function get_input_value_by_id(id) {
377 // For <input ... value=""> elements
378 var element = document.getElementById(id);
379 return element.value;
380}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

42function get(name){
43 return document.getElementById(name);
44}
24getInputNameById(id) {
25 return $(`input[type="radio"]#${id}`).attr('name');
26}
29function input(html_id) {
30 // emulate MATLAB's user-input: use the original (or hacked)
31 // prompt as selection into DOM by id and return the content. We
32 // could change this to a pop-up later.
33 // WARN: We're ignoring the second element, which always seems to be a 's' for string.
34 var elem = document.getElementById(html_id);
35 if (elem.tagName === "INPUT") {
36 return document.getElementById(html_id).value;
37 } else { // e.g., "TEXTAREA"
38 return elem.textContent;
39 }
40}
330getInputData(input_id) {
331 if (this.inputs[input_id])
332 return this.inputs[input_id].data;
333}

Related snippets