Jquery Clear Inline css
css, inline, jquery
Solution
You can use the `!important` in your CSS:
.test{
right:800px !important;
}
That code will make your inline css ignored.
Or you can get the attribute `style` of the DOM , using:
$("div.test").attr("style","");
Or:
$("div.test").attr({style : ""});
That's yours to use solution which you prefer more.
Problem
I have the below JQuery Code and I need to clear the inline css done by this animation ``` $(document).ready(function(){ $("#panel").hide(); //updated line, removing the #panel ID. $('#tab2').toggle(function(){ //adding a toggle function to the #tab $("#panel").show(); $('#ToolsTitleSpan').text("CLOSE TOOLS"); $('#tab2').stop().animate({right: '225'}, 800, 'swing', function() {}); $("#panel").stop().animate({right: '72', width: '230px', opacity:0.8}, 800, 'swing', function() { $('.contentSideBar').fadeIn('slow'); }); }, function(){ //when the #tab is next cliked $('#ToolsTitleSpan').text("OPEN TOOLS"); $('#tab2').stop().animate({right: '-=225'}, 800, 'swing', function() { $('.contentSideBar').fadeOut(slow, function() {}); }); $('#panel').stop().animate({width:"0", position:'absolute', float: 'right', opacity:0.1}, 800, 'swing'); }); }); ``` Here is the HTML code if needed: ``` <div id="panelKS"> <!--the hidden panel --> <div class="contentSideBarKS"> </div> </div> <div id="tab2KS"> <span id="ToolsTitleSpanOpenKS"> <img id="bg" src="<?php echo $OUTPUT->pix_url('/buttons/opentools', 'theme')?>"/> </span> <span id="ToolsTitleSpanCloseKS"> <img id="bg" src="<?php echo $OUTPUT->pix_url('/buttons/closetools', 'theme')?>"/> </span> </div> ``` Can you tell me how can I clear the Inline css please? Thanks