javascript(jqueryなし)でhtmlのブロック全体を削除しようとしています。javascriptでhtmlを取り除く
ソース
<li uib-dropdown="" class="dropdown hidden-xs">
<a uib-dropdown-toggle="" class="dropdown-toggle pointer" "="" aria-haspopup="true" aria-expanded="false">
<img width="22" title=" - [email protected]" height="22" class="img-rounded profile-img" src="https://www.gravatar.com/avatar/edft80b9a51f775c8ee562ca89345318b">
<!-- <b class="caret"></b> -->
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu small-dropdown-menu">
<li><a href="https://app.example.com/#/account">Account</a></li>
<li><a href="https://app.example.com/#/account/billing">Billing</a></li>
<li><a href="https://app.example.com/#/account/team">Team</a></li>
<li><a href="https://app.example.com/#/account/plans">Plans</a></li>
<li class="hidden-lg"><a class="pointer" title="Ask us a question, report a bug or suggest a feature!" href="mailto:[email protected]">Contact</a></li>
<hr>
<li><a target="_self" href="https://app.example.com/logout"><i class="fa fa-sign-out"></i> Logout</a></li>
</ul>
</li>
所望の結果が コードのブロック全体が私の試み
document.getElementsByClassName('dropdown hidden-xs').innerHTML = '';
必要としないでください。ドロップダウンとhidden-xsの間 –
modox2が指摘している構文エラーがあります。参照:MDN [Document.getElementsByClassName](https://developer.mozilla.org/en/docs/Web/API/Document/getElementsByClassName)正しい使い方。複数の要素の内容を削除するには、ループを使用します。 – Roberto