Question

I have an input text field

<input type="text" id="empName"/>

I need to write a value to this field and retrieve the existing value using jQuery? How can I do that?

1 Answers

Set the value of the input text field whose id is empName

$('#empName').val('John');

Get the value of the empName field

var name = $('#empName').val();