Reputation: 679
I want to remove a span
tag from a html output.
Say like i have a variable template
which holds a html output.
<li id="GRP_1" data-role="list-divider">Group 1<span id="121" onclick="deleteGroup(this.id);" class="ui-icon ui-icon-delete ui-icon-shadow li-divider-icon-right"> </span></li>
In the above html output i want to remove/hide the span tag. If possible give me a solution for both hide & remove that span tag. Find the fiddle example here
Upvotes: 0
Views: 282
Reputation: 338
Also:
$('#GRP_1').find('span').hide();
$('#GRP_1').find('span').show();
Upvotes: 0
Reputation: 1073
You could do it in many different ways.
By id:
$('#121').hide();
or $('#121').remove();
By html element:
$('span').hide();
or $('span').remove();
And by class:
$('ui-icon.ui-icon-delete.ui-icon-shadow.li-divider-icon-right').hide();
or
$('ui-icon.ui-icon-delete.ui-icon-shadow.li-divider-icon-right').remove();
Upvotes: 1
Reputation: 32581
$('#121').hide();
$('#121').remove();
I recommend you to change the id from numbers to letters or letters + numbers. Or add a unique class to your span.
Upvotes: 1