Reputation:
Let I've the <a href="/link/">
tag. How can I the following handle: When the CTRL
key is pressed we're left clicked to the <a href="/link/">
tag I want to run an appropriate function which I'll specified as handler of this event. How to do that? I want to do this with pure JS.
Upvotes: 0
Views: 140
Reputation: 608
I can also recommened the Jquery way.
$('#element').click(function(e)
{
if (e.ctrlKey)
{
do_something();
}
});
May be seems a bit less simple, but I guess it gives you more options aswell.
Upvotes: 0
Reputation: 4833
<a href="#test" onclick="if(event.ctrlKey) alert('test');">test</a>
Upvotes: 2