I want a <div> or <li> tag to be clickable (the pointer should change to hand). How can I do it without <a> tag?
Because, when a div is clicked, my javascript loads a text file.
You should add style="cursor:pointer" for the hand pointer and onclick="window.location='somewhere'".
<div style="cursor:pointer" onclick="window.location='index.html'">My Link</div>
var myel = document.querySelector('#myel'); // your element
myel.addEventListener('click', function() {
// do stuff
});
In CSS:
#myel { cursor: pointer }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With