css selectors - Accessing Text within Tags with jQuery -
i've got several html structures this:
<div id="some_id" class="bio"> <h3><img src="some.jpg" alt="alt_text" /><br /> <a name="name"></a></h3> <div class="bio_info"> <h3 class="bio_name">name text</h3> <p>bio text</p> <div class="add_bio">more bio</div> </div> <p><span class="add_bio_toggle">more</span></p> </div>
and i'm looping though them, accessing them using 'this' variable. what's proper way access text have capitalized (name text, bio text, more bio)? i've been trying variations of
var bio.name = $('.bio_info.bio_name', this).html();
to no avail. missing?
[example code] //get national leadership, column $('#national_leadership .left_col .bio').each(function(){ //create new object add nat_leadership array var bio = new object(); bio.id = $(this).attr('id'); bio.name = $('.bio_info', this).find('.bio_name').text(); ...
which finds id fine, returns empty string name.
edit after op's post update:
example each
:
$(".bio").each( function() { var bio_name = $(this).find(".bio_name").text() var bio_text = $(this).find(".bio_name").next().text()); var more_bio = $(this).find(".add_bio").text()); });
Comments
Post a Comment