How to get css default value after jquery function

Hi, I have one question For example:

$("#menu").click(function(){ $("#left_panel, #main_footer").fadeToggle(200); $("#input_content").css({width:"100%"}); }); 

And I want css to get the default property after this function

+6
source share
2 answers

The default height value is auto , so you can set it with:

 $("#input_content").css({ width: 'auto' }); 
+1
source

The easiest way is to set the style to something useless. Then the browser will not interpret it and return to the rules defined in your CSS. Standard way: set it to an empty value:

 $("#input_content").css("width",""); 

If you want to completely reset its default value defined in the browser stylesheet, you can try setting the value to "initial":

 $("#input_content").css("width","initial"); 

Or you yourself set the default value, which is "auto" ( see W3C ).

0
source

Source: https://habr.com/ru/post/972090/


All Articles