【问题标题】:Remove attr in input:style after click with jQuery使用 jQuery 单击后删除 input:style 中的 attr
【发布时间】:2011-12-01 09:32:54
【问题描述】:

如何在使用 jquery 单击后在以下 select:style 中仅删除 background-color: rgb(255, 196, 196);

<input name="star" style="width: 60px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 196, 196); background-position: initial initial; background-repeat: initial initial; ">

【问题讨论】:

    标签: javascript jquery


    【解决方案1】:

    您可以使用.css() 函数:

    $('input[name="star"]').css({ backgroundColor : '' });
    

    【讨论】:

      【解决方案2】:
      $('input[name="star"]').click(function(){
          $(this).css({'background-color':''});
      });
      

      您可以在这里阅读更多内容:Remove CSS from a Div using JQuery

      【讨论】:

        【解决方案3】:
        $("input[name=star]").click(function () {
            $(this).css("background-color", "")
        })
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-02-28
          • 1970-01-01
          • 1970-01-01
          • 2017-11-25
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-08-03
          相关资源
          最近更新 更多