1

I want to remove the everything under the classname: social-share using JavaScript

HTML: This is what it looks like when I grab the code from chrome inspector.

<div class="social-share">
      [shareaholic app="share_buttons" id="26444890"]
</div>

HTML: This is what exactly looks like inside the chrome inspector

<div class="social-share">
"
[shareaholic app="share_buttons" id="26444890"]
" == $0
</div>
user354355
  • 41
  • 6

2 Answers2

1

You can use innerHTML to clear the contents of the element after it has been selected:

// select element with class 'social-share:
var social_share = document.querySelector('.social-share');

// Set it's contents to an empty string
social_share.innerHTML = '';
Pineda
  • 7,435
  • 3
  • 30
  • 45
0

$('.social-share').empty();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="social-share"> content
      <div>content</div>
</div>

Jquery empty() might be help you. It will remove every thing inside social-share class

sumit chauhan
  • 1,270
  • 1
  • 13
  • 18