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
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.