<cite>
text here...
<a id="target_element"></a>
</cite>
How to get the text before #target_element?
<cite>
text here...
<a id="target_element"></a>
</cite>
How to get the text before #target_element?
This isn't the prettiest solution but it will work in that specific case:
$('#target_element').parent().text();
It is best to put that text in another element, like a span. Otherwise, that text can get messed up really easily. If it was in a span, you could do something like:
$('#target_element').prev().text();
That way you will run into less errors.
EDIT
I found another way:
var elementClone = $('#target_element').clone();
elementClone.children().remove();
elementClone.text();
at first time make a place for replacement:
<div id="target"></div>
<a id="target_element"></a>