i have a little problem with my script. I need to check some span, if i have some content in the middle of it i do nothing… but if it’s empty i want to remove this span or for example change style. Now when specify span is empty script cleans all of my spans, even their are not empty. Can you help me?
html
<span class="insert_list_item"></span>
<span class="insert_list_item">data</span>
script
if ($('.insert_list_item').length > 0){
$('.insert_list_item').each().remove();
}
How about:
Live demo: http://jsfiddle.net/RMZLm/
Note that this solution also works on SPAN elements that contain white-space (e.g.
<span class="insert_list_item"> </span>).