I want to select a div with an id or class and at the same time exclude a id or class inside the div and get the content as string.
Here is my markup:
<div id='main-content'>
<div>test 1</div>
<div class='ignore'>ignore test</div>
</div>
I tried $('#main-content:not(.ignore)').text();
It is selecting the div with the id main-content, but the class ignore is still in the string. What am I doing wrong?
Here is a fiddle example.