2017-09-11 4 views

답변

1

여기에 Twilio 개발자 전도사가 있습니다.

<div>을 ID 또는 CSS 선택기로 타겟팅 할 수 있다면 <div> 요소 내에서 그렇게 할 수 있습니다. 그래서, 다음과 같은 HTML과 :

<div id="localVideo"> 
    <video></video> 
</div> 

은 그럼 당신은 document.getElementById 또는 document.querySelector으로 <div>를 얻을 수 있습니다 다음 element.querySelector를 사용하여 <div> 내에서 검색.

const div = document.getElementById('localVideo'); 
if (div.querySelector('video')) { 
    console.log('There is a video!'); 
} else { 
    console.log('No video yet.'); 
} 

element.querySelector는 그렇지 않은 경우가있는 경우 또는 null 검색하는 요소를 반환합니다.

전혀 도움이되는지 알려주세요.