rubo77
rubo77

Reputation: 20865

Catch onclick-event with CTRL pressed

Is there a simple solution without jquery, inside HTML-tags to catch a CTRL+Mouseclick?

It could look like this:

<a href="#" onclick="if(ctrl_is_pressed()) alert('CTRL+Mouseclick');">X</a>

Upvotes: 0

Views: 2943

Answers (1)

gen_Eric
gen_Eric

Reputation: 227310

In the event object, there's a ctrlKey property.

<a href="#" onclick="if(event.ctrlKey) alert('CTRL+Mouseclick');">X</a>

Upvotes: 7

Related Questions