Adding and removing style attribute from div with jquery

前端 未结 7 2003
走了就别回头了
走了就别回头了 2021-01-30 00:53

I\'ve inherited a project I\'m working on and I\'m updating some jquery animations (very little practice with jquery).

I have a div I need to add and remove the style at

7条回答
  •  囚心锁ツ
    2021-01-30 01:21

    In case of .css method in jQuery for !important rule will not apply.

    In this case we should use .attr function.

    For Example: If you want to add style as below:

    You should use:

    $("#voltaic_holder").attr("style", "position:absolute;top:-75px !important");

    Hope it helps some one.

提交回复
热议问题