i have a div element with id hover-1, within the div i have a hidden form element having class name text_page_title in the hierarchy.
i got the parent div element id dyanamically in a variable, now i want to find the hidden element having class name text_page_title and set its value to ‘foo’
structure is like:
<div id="hover-1">
<input type="hidden" class="text_page_title">
</div>
<div id="hover-2">
<input type="hidden" class="text_page_title">
</div>
I m trying to do it like:
$($parentId).find('input.text_page_title').val('foo');
but it doesnt work, m i missing something?
This works:
If you want your parent id in a variable:
working jsFiddle