Reputation: 859
I want to disable class automatically applied on div.
<div class="A B">
I want to disable Class 'A' but not 'B'. How could I do that ?
Upvotes: 1
Views: 66150
Reputation: 287
This code will act magically....
<script type='text/javascript'>
jQuery(document).ready(function ($) {
$( "div" ).removeClass( 'your_class_name' );
});
</script>
Upvotes: 0
Reputation: 105
If you want to do this in straight js, give the div an ID:
<div id="myDiv" class="A B"></div>
And then in js:
document.getElementById("myDiv").classList.remove("B");
Upvotes: 2
Reputation:
I think that I accomplished succesefully. :)
For example I have my html code :
<a class="m2" href="#">Some text here, with bold</a>
<a class="m2 nobold" href="#">Some text here, without bold</a>
I use CSS for the first text
.m2 {
font-weight: bold;
}
And for disable it, I use
.nobold {
font-weight: normal;
}
And it apply both, but you can change settings from the other CSS class ...
Upvotes: 0
Reputation: 33439
I think you are looking for CSS that says. Don't listen to class A.
Alas, there is no such CSS.
Upvotes: 12
Reputation: 3540
You are probably looking for a javascript...
Add a id to your div and use
<div id="whatever" class="A B"></div>
<script type="text/javascript">
window.document.onload = function(){
document.getElementById("whatever").className = "A";
}
</script>
Upvotes: 4