JSFiddle - React, Tailwind, and code Playground
by lazerblade01
HTML
<a href="javascript:;">Clicked me</a>
JavaScript
$(document).ready(function(){
$('a').click(function() {
someFunction();
});
});
var clicked = '';
$('a').click(function() {
if (typeof event == 'undefined') {
clicked = $(this).attr('href');
someFunction(clicked);
}
});
function someFunction(clicked) {
var theClicked = '';
if (typeof event != 'undefined') {
theClicked = (event.target) ? event.target : event.srcElement;
theClicked = $(theClicked).attr('href');
clicked = '';
} else if (typeof clicked !='undefined' && clicked.length > 0) {
theClicked = clicked;
}
if (theClicked.length > 0) {
console.log(theClicked);
}
}