I am trying to write code to search all children for a div that has a specific class. The DIV does not have an ID. Here is the HTML I will be using.
<div class="outerBUBGDiv">
<div class="innerBUBGDiv">
<div class="bgHeaderH2">Technology Group</div>
<div class="bgBodyDiv">
<div align="center">
<img height="33" border="0" width="180" src="/heading.jpg"/>
/////other stuff here/////
</div>
</div>
</div>
Any ideas how I can get the text inside the div with the class bgHeaderH2.
Thanks in advance.
Comment added, didn't explain this very well initially)
This question is related to
javascript
jquery
$(this).find(".bgHeaderH2").html();
or
$(this).find(".bgHeaderH2").text();
I'm not sure if I understand your question properly, but it shouldn't matter if this div is a child of some other div. You can simply get text from all divs with class bgHeaderH2 by using following code:
$(".bgHeaderH2").text();
Source: Stackoverflow.com