/ Gists / Remove via $event / $el
On gists

Remove via $event / $el

Alpine.js

remove.html Raw #

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="//unpkg.com/alpinejs" defer></script>
</head>
<body>
  <div x-data>
      <button @click="$el.remove()">remove me 1</button>
      <button @click="$event.target.remove()">remove me 2</button>
  </div>
</body>
</html>