I am trying to select elements from the HTML Element. But not working. How to do it? I have used query selector but it is not working. Only it is working inside settimeout. Without settimeout how to achieve?
HTML: Getting this from console.log(drop);
<div class="container">
<dropdown-part>
<select>
<option>2</option>
</select>
</dropdown-part>
</div>
TypeScript:
let dropcover = this.shadowRoot.querySelector('.container') as HTMLElement;
console.log(drop);
console.log(dropcover.querySelector('dropdown-part')); // Getting null
setTimeout(function(){
console.log(dropcover.querySelector('dropdown-part')); // working
},0);