Home > Back-end >  I'm trying to remove classes like class="row" and class="col-md-12" coming
I'm trying to remove classes like class="row" and class="col-md-12" coming

Time:08-25

I'm trying to remove classes like and coming from a script file from bootstrap. Can I override and remove it with css?

CodePudding user response:

I don't believe you can remove a class from the markup with css. You could add an additional class and then make your needed style changes with that more specific selector.

CodePudding user response:

I think that what you want is to hide them by default? If so, create a rule on your css for the mentioned classes.

.row,  .col-md-12{
 display: none;
}

Then after, if you want to show them, you can use js to present the elements with that class. Ex:

document.querySelector('.row').style.display= 'block';

CodePudding user response:

You can't remove the class names via CSS, but you can retrieve all the elements with those class names and remove the class: document.querySelectorAll(".row").forEach(r => r.classList.remove("row"));

  • Related