I want to get the value of an id from a nested div - jquery

Posted by Jean on Stack Overflow See other posts from Stack Overflow or by Jean
Published on 2010-06-15T12:12:48Z Indexed on 2010/06/15 12:22 UTC
Read the original article Hit count: 149

Filed under:

Hello

I want to obtain the .text() of #inner2

<div class="outer" id="outer">

<div id="inner1" class="inner">test1</div>
<div id="inner2" class="inner">test2</div>
<div id="inner3" class="inner">test3</div>


</div>

This is the jquery function I am using

$('.outer').bind('click',function() {


var one = $('#inner'+x).attr('id');
alert(one);


});

The problem is the first #id value is show in the alert.

Thanks

Jean

© Stack Overflow or respective owner

Related posts about jQuery