jQuery - val()

The val() is usually used for getting and setting form field elements, ie: form controls.

Hello World

 

W3Schools.com

 


$("#btnGet").click(function ()
{
    $("#demo1").html($("#txtSource").val());
});

$("#btnSet").click(function ()
{
    $("#txtSource").val("Good morning Dave.");
});