Reputation: 1695
I have the following code in a php page
<div class="vmenu">
<div class="first_li"><span >Add Shift</span></div>
<div class="first_li"><span>Add Comment</span></div>
</div>
Now I want to remove the div contains text "Add Shift" on document ready
Upvotes: 0
Views: 128
Reputation: 7536
$('div.vmenu div:first-child').remove();
check it out on jsfiddle: http://jsfiddle.net/7CFAq/
Upvotes: 0
Reputation: 26
$(function(){
$('.first_li span:contains('Add Shift')').remove();
});
Upvotes: 1
Reputation: 119837
Use jQuery .remove()
and :contains()
. Note that it's case sensitive
$('div:contains("Add Shift")').remove();
Upvotes: 1