Jquery Returning undefined when using “click” listener

THIS IS MY HTML CODE


<div action="https://github.com/">
     <div class="menu-bar-item">
         <h1 class="menu-item-text">GitHub</h1>
     </div>
</div>

AND JAVASCRIPT


$(document).on("click", "*[action]", (e) => {

    try {
        var attribute = $(e.target).attr("action");
        alert(attribute)

    } catch(e){}
})

Here attribute action is sometimes retuning “undefined”.. ANY FIX??