I have several div elements like this:
<div class="newsContainer">
<div class="deleteBoxIcon">
<img alt="Delete" src="close_mark.png">
</div>
<div class="newsImage">
<img alt="NewsImage" src="umbrella.png">
</div>
<div class="newsContent">
<b>Here goes a title</b><br>
Here goes some content.
</div>
</div>
Based on certain conditions, I retrieve one of those divs and save it into an object (draggable), now I need to extract the title and content texts to input controls.
Getting the title is not difficult for me, I’m just doing this:
var title = $('.newsContent > b', $(draggable)).text();
But the hard part for me is getting the content, I’ve tried this but it’s not working because it retrieves all the text (including the title):
var content = $(':not(.newsContent > b)', $(draggable)).text();
Hope you can help me to get only the content part of a div like this.
Try this:
Example fiddle