Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jquery Child Selector

<ul class="main-list">
    <li>
        <a href="#">Item One <span>+</span></a>
    </li>
</ul>

this is an example list,from this list I want to get the text of a using jquery,but I do not want to get the text between the span tag,I have tried many jquery selector,but no luck so far.Can any one please help with this.

http://jsfiddle.net/mkhLB/ list sample can be viewed here

1 Answer

Some clever use of a few jQuery methods to get this text: http://jsfiddle.net/76C6w/1/

Source: http://stackoverflow.com/a/8851526