Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はテンプレートを扱っており、イベントに応答するときに将来更新するための特定の要素を見つけています。ただし、事前にマークアップを知らなくても、クラス、data-* 属性などでこれらの要素をマークできる機能が必要です。
.filter()と.find()検索を同時に実行する方法はありますか?
この目的のための単純な拡張:
jQuery.fn.findIn = function(selector){ return this.filter(selector).add(this.find(selector)); }
次に、単に呼び出します.findIn('.your-selector')。
.findIn('.your-selector')
現在、より良い名前の提案を行っています。