Reputation: 6362
How can i remove the span element via jquery?
I cannot count on li id selector because all ol is being built dynamically
<div class="on">
<ol id="selectable" class="ui-selectable">
<li id="11_3_6" class="ui-widget-content ui-selectee">11.3.6</li>
<li id="10_3_16" class="ui-widget-content ui-selectee">10.3.16</li>
<li id="11_2_26" class="ui-widget-content ui-selectee ui-selected">11.2.26<span class="ui-icon ui-icon-check"></span></li>
<li id="9_1_53" class="ui-widget-content ui-selectee">9.1.53</li>
</ol>
</div>
I don't want to remove the entire li. just the span
Upvotes: 0
Views: 1566
Reputation: 1
$('div.on ol.selectable li span').remove();
this will remove span element and its content from your HTML. always use specific element with id while removing otherwise it might remove others also.
Upvotes: 0
Reputation: 82923
If you are looking to remove the span from the li element, try this:
$(".on > ol > li > span").remove()
Upvotes: 1