JQuery - Element Selection

Posted by user208662 on Stack Overflow See other posts from Stack Overflow or by user208662
Published on 2010-05-07T13:04:42Z Indexed on 2010/05/07 13:08 UTC
Read the original article Hit count: 183

Filed under:

Hello,

I'm relatively new to JQuery. I'm trying to understand how to select a child element. Currently, I have some HTML that is defined as follows:

<div id="elem1">
 <div class="display">Student 1</div>
</div>

<div id="elem2">
  <div class="display">Student 2</div>
</div>

<div id="elem3">
  <div class="display">Student 3</div>
</div>

When a user clicks a link, one of the elements (elem1, elem2, or elem3) is going to be passed to a function that is defined as follows:

function getNodeDisplay(node) {
  // NOTE: This does not work as desired
  return $(node).(#".display").html();
}

Unfortunately, this approach does not work. How do I get the HTML associated with an element that has a specific class or a given element? Thank you for your help!

© Stack Overflow or respective owner

Related posts about jQuery