Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

alpine js open outside div

<div x-data="{id: 1}">
    <button @click="$dispatch('open-dropdown',{id})">Open Dropdown</button>
</div>

<ul x-data="{ open: false }"
    x-show="open"
    @open-dropdown.window="if ($event.detail.id == 1) open = true"
    @click.away="open = false">
    Dropdown Body
</ul>
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to run react native app on simulator 
Javascript :: countdown js 
Javascript :: react redux not updating 
Javascript :: async await javascript push 
Javascript :: array.flat 
Javascript :: js naming conventions 
Javascript :: jquery bootstrap checkbox val 
Javascript :: angular router link 
Javascript :: javascript replace tag 
Javascript :: JavaScript setTimeout js function timer command 
Javascript :: trigger click on first row datatable jquery 
Javascript :: how to get MathJax 
Javascript :: see if array contains array javascript 
Javascript :: use useRef to get current class 
Javascript :: async promise javascript 
Javascript :: current page number and clicked page number jqery datatables 
Javascript :: curl post request 
Javascript :: javascript ISO Date Formats 
Javascript :: how to input from user in javascript 
Javascript :: javascript how to do if else 
Javascript :: js do while loop 
Javascript :: ?? in javascript 
Javascript :: angular date pipi locale 
Javascript :: prepend to js array 
Javascript :: javscript assert 
Javascript :: create method javascript 
Javascript :: trim string and place ... javascript 
Javascript :: prisma bigint 
Javascript :: React social login button 
Javascript :: getelementbyclassname get multiple class 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =