Reset/remove CSS styles for element only

前端 未结 14 842
长情又很酷
长情又很酷 2020-11-22 00:52

I\'m sure this must have been mentioned/asked before but have been searching for an age with no luck, my terminology must be wrong!

I vaguely remember a twee

相关标签:
14条回答
  • 2020-11-22 01:35

    if you set your CSS within classes, you can easly remove them using jQuery removeClass() Method. The code below removes .element class:

        <div class="element">source</div>   
        <div class="destination">destination</div>
          <script>
            $(".element").removeClass();
          </script>
    

    If no parameter is specified, this method will remove ALL class names from the selected elements.

    0 讨论(0)
  • 2020-11-22 01:36

    For those of you trying to figure out how to actually remove the styling from the element only, without removing the css from the files, this solution works with jquery:

    $('.selector').removeAttr('style');
    
    0 讨论(0)
提交回复
热议问题