【问题标题】:jQuery filter by reljQuery通过rel过滤
【发布时间】:2013-03-01 19:48:08
【问题描述】:

我正在尝试过滤所有具有 rel 属性的链接,然后更改该属性。我知道它应该很简单......但无法让它发挥作用。

$('#selector a[rel]').each(function() {
  $(this).attr('rel', 'lightbox[auto_group999]');
});

【问题讨论】:

标签: jquery filter rel


【解决方案1】:
$(function(){ // DOM is ready to be manipulated

    $('#selector a[rel]').each(function() { // now the selector is retrieved
      $(this).attr('rel', 'lightbox[auto_group999]');
    });

});

jQuery API - .ready()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-15
    • 2010-10-27
    • 1970-01-01
    • 2020-09-03
    • 1970-01-01
    • 2016-09-29
    相关资源
    最近更新 更多