LoginSignup
0
0

More than 3 years have passed since last update.

jQueryで動的にcloneした要素にプラグインを適用したい

Last updated at Posted at 2020-01-17

背景とか

jQueryでclone(true)すれば、全ての要素が引き継がれるとどこかで書いてありましたが、できなかった。そのための備忘録として。

対応

eachを使って、プラグインを適用する。

let clone = $('selector');
clone.each(function (idx, obj) {
  $(obj).hogehoge();
});

// 子要素に適用したい場合
clone.find('.fuga').each(function (idx, obj) {
  $(obj).hogehoge();
});
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0