sangram
sangram

Reputation:

jquery accessing/changing value attribute of an element

how to deal with value attribute of any element (hidden input in my case)

i have tried with two styles

alert($("#projectManager").attr("value"));

and 

alert($("#projectManager").val());

but it returns 'undefined'.

any help?

Upvotes: 0

Views: 703

Answers (1)

Traveling Tech Guy
Traveling Tech Guy

Reputation: 27811

Make sure you specify id="projectManager" on the input field. a 'name' attribute is not enough for this selector. And .val() is the way to go to get a field value.

Upvotes: 3

Related Questions