Alpine JS Click Event Example

May 08, 2021 . Admin

Hi Guys,

In this Tutorial,I will learn you how to use alpine js @click event.you can easy and simply use alpine js simple click event.

you can also use this example with php laravel alpine js project.

I will give you simple click event using alpine js you can see on below example code. you can simply copy and check that.

<!DOCTYPE html>
<html>
<head>
	<title>Alpine JS @click Event Example - MyWebtuts.com</title>
	<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.8.2/dist/alpine.min.js" defer></script>
</head>
<body>

<div x-data="{ open: false }">
	<button @click="open = !open">Click to List Categories</button>
	<ul x-show="open">
		<li>PHP</li>
		<li>Laravel</li>
		<li>Vue</li>
		<li>React</li>
	</ul>
</div>

</body>
</html>

I Hope It Will Help You..

#Alpine JS