I have to component table
and form
when I run the test in the table(Parent) component the select2 is working but when I click the modal and run the test in the form(Child) component select2 is not working.
I tried to use Livewire JS hooks but still not working
document.addEventListener('DOMContentLoaded', function() {
$('#ex').select2();//table
$('#example').select2({
dropdownParent: $("#joborderModal")
});//form
});
Livewire.hook('element.initialized', (el, component) => {
$('#ex').select2();//table
$('#example').select2();//form
console.log('initialized....');
});