Obtenir la valeur d'une entrée

Exemples de code

51
0

Javascript obtient la valeur d'entrée de texte

var inputValue = document.getElementById("myTextInputID").value;
2
0

obtenir la valeur de l'entrée js

<!-- for simplicity's sake, I have the js code and html in the same file -->
<!-- if you want to, you can add the js in another file and make a <script> tag and link it up to the html file -->

<html lang="en">
<head>
<meta charset="utf-8">
<title>Get Text Input Field Value in JavaScript</title>
</head>
<body>
    <input type="text" placeholder="Type something..." id="myInput">
    <button type="button" onclick="getInputValue();">Get Value</button>
    
    <script>
        function getInputValue(){
            // Selecting the input element and get its value 
            var inputVal = document.getElementById("myInput").value;
            
            // Displaying the value
            alert(inputVal);
        }
    </script>
</body>
</html>
-1
0

obtenir la valeur du champ de saisie

<h1>Hi Hello</h1>

Dans d'autres langues

Cette page est dans d'autres langues

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................