Check Ctrl key on click
by Luca De Nardi
HTML
<div id = "1">
<h2>title1</h2>
<p>content1</p>
<span>something else</span>
</div>
<div id = "2">
<h2>title2</h2>
<p>content2 <span>the rest of content2</span></p>
<span>something else</span>
</div>
<div id = "3">
<h2>title3</h2>
<p>content3 <a>a link in the content3</a></p>
<span>something else</span>
</div>
CSS
div{
border: 1px solid gray;
margin: 5px;
padding: 5px;
}
JavaScript
$("div").on("click", function(event){
alert("Ctrl Key pressed? " + (event.ctrlKey?'YES!':'Nope..'));
var url = window.location.href;
var anchor = $(this).attr("id");
var url_of_elm = url + "#" + anchor;
});