I have this:
$(document).ready(function() {
$("#center").click(function{ });
}
I know that you can get documentbyID with javascript. How do I get the value of a form input with jquery?
I have this:
$(document).ready(function() {
$("#center").click(function{ });
}
I know that you can get documentbyID with javascript. How do I get the value of a form input with jquery?
To get value of a form input , use
$("#idOfInput").val();
$(".classOfInput").val();
$("[name='yourInputName']").val();
HTML
<form>
<input type="text" name="yourInputName" class="classOfInput" id="idOfInput"/>
</form>
Assuming you want to alert the value and you are using jquery:
function foo(){
alert($("#myInput").val());
}
And your html:
<form>
<input type="text" name="myInput" id="myInput"/>
</form>
<button onclick="foo()">Click</button>
Here is a fiddle as an example: