Reputation: 3159
I have several div's with the class .agrRow. In each .agrRow there is an input field with the name agrNameOF.
I want to set the value of that field. I've tried something like:
$(".agrRow:last input[type='input'][name='agrNameOF']").val(fname);
but that doesn't work.
What is the correct syntax?
Upvotes: 3
Views: 81
Reputation: 109
Try:
$('.agrRow input[type="text"][name="agrNameOF"]').val(fname);
why you use :last?
Upvotes: 1
Reputation: 2768
try changing input[type='input']
to input[type='text']
or if it can be other types too then just do input[name='agrNameOF']
JSFiddle: http://jsfiddle.net/6tf6fbcn/
Upvotes: 3