가능한 중복 : ....의 차이점은 무엇입니까?
jQuery('.classname', this.frame)
와 this.frame.find('.classname')
의 차이점은 무엇입니까
What is the difference between $(“”, $(“#container1”)) and $(“#container2”).find(“”)?
감사합니다.
가능한 중복 : ....의 차이점은 무엇입니까?
jQuery('.classname', this.frame)
와 this.frame.find('.classname')
의 차이점은 무엇입니까
What is the difference between $(“”, $(“#container1”)) and $(“#container2”).find(“”)?
감사합니다.
this.frame
이 jquery 개체가 아니기 때문에 두 번째 예제가 폭발합니다. 그것 이외에, 그들은 동등하다. 당신이 jQuery의 소스 코드를 보면
는 당신이 $(this.frame).find('.classname')
jQuery 객체가 아니라고 말할 수 없습니다. –
@JamesAllardice jQuery 객체라고 말할 수는 없습니다. ;피 – meze
아무것도 의미하지 수도, jQuery('.classname', this.frame)
그냥 그 문제에 jQuery(this.frame).find('.classname')
를 호출, 당신은 단지 documentation을 읽을 수있는 펠릭스 왕으로 상태는 다음과 같습니다.
내부적으로 선택기 컨텍스트가 구현됩니다. ith .find() 메쏘드와 같이, $ ('span', this)는 $ (this) .find ('span')와 같습니다.
이들은 동일합니다. –
...'this.frame'이 jQuery 객체가 아니라면 달라집니다. – Matt
[문서 읽기] (http://api.jquery.com/jQuery/)도 도움이됩니다. * "내부적으로 선택기 컨텍스트는'.find()'메서드로 구현되므로'$ ('span', this)'는 $ (this) .find ('span')'.와 동일합니다. * –