Form Value Handling in jQuery — a practical guide to jQuery val() with clear examples you can reuse in real projects.
jQuery Tutorial Series (58/101). Prefer one article? Read the complete jQuery tutorial.
Short description
Works for text, select, and checkbox value attributes (use prop for checked).
val()
var email = $('#email').val();
$('#email').val('user@example.com');
$('#role').val('editor');