How do you get the value of an input, checkbox and radio button in jQuery?

<input type="text" id="name" value="Anita">
<input type="checkbox" id="agree" checked>
<input type="radio" name="plan" value="free">
<input type="radio" name="plan" value="pro" checked>
console.log($('#name').val());
console.log($('#agree').is(':checked'));
console.log($('input[name=plan]:checked').val());
Console output

Anita
true
pro

See jQuery Forms.


Learn more about the similar topics:
Tutorials
jQuery Forms
Exercises & Assignments
Write jQuery code to validate that a field is not empty before submit
Write jQuery code to show the remaining characters of a textarea
Write jQuery code for a “select all” checkbox
Write jQuery code to enable the submit button only when a checkbox is checked
Write jQuery code to copy the text of one field to another field
Interview Questions & Answers
How do you get the value of an input, checkbox and radio button in jQuery?
How do you serialize a form in jQuery?