I want to set all my css to null with the use of jQuery. I know you can do it like
$("[class^=col-]").css('width', '');
$("[class^=col-]").css('right', '');
$("[class^=col-]").css('margin', '');
$("[class^=col-]").css('position', '');
but is it possible to do it in one command, like:
$("[class^=col-]").css('');
Edit: i have looked in the post above and saw the answer.
By removing the style atrribute it works perfectly $("[class^=col-]").removeAttr("style")
You need to use the default values for those properties to override the values you have set
$(document).ready(function() {
$("[class^=col-]").css({
'width': 'auto',
'position': 'inherit',
'margin': '0',
'right': '0'
});
});
.col-md-12 {
width: 10px;
position: fixed;
margin: 10px;
right: 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-md-12">some test</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With