@Wana1

Удалить через javascript удалить class?

Может я не правильно вопрос задаю нужно удалить все классы со страницы

код html
<html class="v611 no-js sidebar-on" id="root" lang="ru" data-view="doc" data-func="any">
    <body class="desktop logged n noscroll toolbar-search-on fixed-sidebar-view blocked-open-sidebar fixed round-avatars full-height two-columns-layout toolbar-fixed widget-redesign float-sidebar">
        <div id="wrapper" class="wrapper portal __sidebar">
            <div class="two-columns-layout-content">          
                <div id="boxPage" data-logloc="selectPresent" class="portal-container">
                    <div id="content"></form>
                        <div id="searchableListContent" class="ajax-nav-search-results"><div class="gift-section"></div>
                            <div class="dlist init js-append-bot or-ver gifts_list"></div>
                                <ul id="present-list-bd" class="list-block l gifts_ul grid __js-simple-gifts-section_last" data-prev-url="" aria-live="polite" role="log" data-next-url="">
                                    <li class="it grid_li __double">
                                        <div class="gift-card __ru __live __large  __sale __no-frame" aria-label="">
                                            <div class="gift" style="background-image: url(//); " aria-label="null">
                                                <img src="" width="24" class="gift-control" height="24"/>
                                            </div>
                                            <div class="gift-price ">
                                                <span class="gift-price_icon"></span>
                                                <span class="gift-price_text"></span>
                                            </div>
                                            <a aria-label="" aria-label="null" href="" class="gift-link"></a>
                                        </div>
									                  <li class="it grid_li __double">
                                        <div class="gift-card __ru __live __large  __free __no-frame" aria-label="">
                                            <div class="gift" style="background-image: url(//); " aria-label="null">
                                                <img src="" width="24" class="gift-control" height="24"/>
                                            </div>
                                            <div class="gift-price ">
                                                <span class="gift-price_icon"></span>
                                                <span class="gift-price_text"></span>
                                            </div>
                                            <a aria-label="" aria-label="null" href="" class="gift-link"></a>
                                        </div>


Удалить надо полностью класс it grid_li __double и __sale а класс it grid_li __double и __free оставить

может подскажите учусь хочу разобраться пытаюсь через
document.querySelectorAll('.__sale')[0].classList.remove('__sale')
  • Вопрос задан
  • 189 просмотров
Решения вопроса 1
Kozack
@Kozack Куратор тега JavaScript
Thinking about a11y
document.querySelectorAll('.className').forEach(e => e.classList.remove('className'))
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы