JSFiddle - React, Tailwind, and code Playground

by queryj

HTML

<div> <a href="#" onclick="clicked();">Click here, this won't work.</a>

</div>
<div> <a href="#" onclick="clicked2();">Click here, this works.</a>

</div>
<div> <a href="javascript:void(0);" class="link">Click here, this will also work.</a>

</div>
<script>
    $(function() {
        function clicked() {
            alert("yes, clicked.");
        }

        $("a.link").click(function() {
            // get your position below
            var position = 1;
            alert("unobtrusive and position is " + position);
        });
    });

    function clicked2() {
        alert("yes, clicked2.");
    }
</script>