jquery - Retrieve text of nested div inside a div -



jquery - Retrieve text of nested div inside a div -

i have html

<div onclick="get_nested_value"> <div class="inner_div"> hello </div> <div>

now want jquery function this

function get_nested_value() { alert($(this.'.inner_div').text()); }

where this.'.inner_div' must point class inner_div

but must have been doing silly syntactical error.

any suggestion?

try this:- in html:-

<div onclick="get_nested_value(this)"> <div class="inner_div"> hello </div> <div> function get_nested_value(e) { alert($(e).find('.inner_div').text()); }

jquery

Comments