Reputation: 23
I'm trying to get value from input tag but it returns an empty string. When I open frame source it shows something like
<input type="hidden" name="" class="code_item" value="00-00000159" />
To get value I'm trying with
$(this).children('td').children('.code_item').value
Please, help me to find the error, I'm new for this.
Upvotes: 2
Views: 85
Reputation: 67505
Because you're using jquery selectors you should use val()
instead of .value
:
$(this).children('td').children('.code_item').val()
Or add [0]
to return javascript object then you could use .value
:
$(this).children('td').children('.code_item')[0].value
It could be done also without using children()
:
$('td .code_item', this).val();
Hope this helps.
Upvotes: 0
Reputation: 559
In jquery use .val() instead of .value
$(this).children('td').children('.code_item').val()
Upvotes: 1