代码之家  ›  专栏  ›  技术社区  ›  Liam neesan

如何使用jquery删除$(document).on()属性?

  •  -3
  • Liam neesan  · 技术社区  · 6 年前

    我想删除动态创建的样式属性。。

    我试过了。

    $(document).on('click', '#refresh', function () {
         alert('test button');  //alert is working
         $('#dialogClose').removeAttr("style");
     });
    

    注意

    两个按钮 #refresh #dialogClose 是动态创建的。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Jack Bashford    6 年前
    $(document).ready(function() {
    
        $('#refresh').on('click', '#refresh', function () {
            $('#dialogClose').removeAttr("name_of_your_attr");
        });
    })
    

    你应该把它放在你的元素之后,你的页面准备好确认 click 从浏览器中删除事件。