Double-click fun
HTML
<div id="xxx"></div>
<span>Double click the block</span><br>
<button>Simulate a double-click</button>
CSS
div {
background: blue;
color: white;
height: 100px;
width: 150px;
}
div.dbl {
background: yellow;
color: black;
}
JavaScript
$("div:first").dblclick ( function () {
$(this).toggleClass ( "dbl" );
} );
$("button").click ( function () {
var targLink = document.getElementById ("xxx")
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('dblclick', true, true);
targLink.dispatchEvent (clickEvent);
} );