Created
October 9, 2025 22:35
-
-
Save mkhuda/5b0b1cd247f128e29c931e70c0059427 to your computer and use it in GitHub Desktop.
jQuery vs Alpine.js Comparison
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- jQuery version --> | |
<div id="jquery-example"> | |
<button id="btn-jq">Toggle jQuery</button> | |
<div id="box-jq" style="display:none;">Halo dari jQuery!</div> | |
</div> | |
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> | |
<script> | |
$('#btn-jq').click(function() { | |
$('#box-jq').toggle(); | |
}); | |
</script> | |
<hr> | |
<!-- Alpine.js version --> | |
<div x-data="{ open: false }" id="alpine-example"> | |
<button @click="open = !open">Toggle Alpine</button> | |
<div x-show="open">Halo dari Alpine.js!</div> | |
</div> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js" defer></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment