2013-11-28 1 views

답변

13

먼저이 될 것 length

if( $(".mydiv").find("script").length) 
    {  
     alert("exist"); 
    } 
+0

감사에 대한 –

+0

환영합니다 @happi its my pleasure –

5

div와 Descendant Selector (“ancestor descendant”)을 사용할 수 있습니다. 주어진 조상의 후손 인 모든 요소를 ​​선택 : 선택과 length를 사용하면 얼마나 많은 컨테이너에서 찾을 수 script (tag) 요소 클래스 mydiv

if($('.mydiv script').length) 
{ 
    //script tag found 
} 

설명과 사업부는 것을 보여줍니다. 다음 확인 후 script을 찾을 클래스 .mydiv와 요 사업부를 이동

+0

도와 주셔서 감사합니다 :)에 대한 당신의 도움 – Adil

+0

감사 @Riturajratan –

0

:

$(function(){ 
    if($('.mydiv').children('script').length>0){ 
    // have script tab. 
    } 
}); 
관련 문제