"해당"변수에 요소 목록이 있습니다. 특정 애트리뷰트가있는 요소를 어떻게 찾을 수 있습니까?jQuery - 요소 목록에서 특정 속성이있는 요소 선택
(function($) {
$.fn.blah = function(){
var that = this;
return this.each(function(){
$(this).bind('change', function(){
$("[name]", that).dostuff(); // <- doesn't seem to work
return true;
}).change();
});
};
})(jQuery);
을 사용할 수 있습니다, 감사합니다. jquery 이상한입니다 : x – Alex
@Alexandra : 왜 이상한가요? 중요한 방법 중 일부를 배워야한다고 생각합니다. 'that '에있는 요소의 모든 * 하위 항목을 검색 할 that.find ("[name]")'과 동일하기 때문에 $ ("[name]", that)'는 작동하지 않습니다. 셀렉터와 일치합니다. –
Btw. 'that'은 이미 jQuery 객체이므로 'that.filter'가 충분해야합니다. –