First you need to change all ”
in your code with '
or "
HTML:
<a href="Title Blue.png" download="Title Blue.png">Download Title Picture</a>
<span id='op'>Demo Time</span>
<div id='cntnr'>
<ul id='items'>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
<li>Item5</li>
</ul>
</div>
JS:
$(document).bind('contextmenu',function(e) {
e.preventDefault(); // To prevent the default context menu.
$('#cntnr').css('left', e.pageX); // For updating the menu position.
$('#cntnr').css('top', e.pageY); //
$('#cntnr').fadeIn(500, startFocusOut()); // For bringing the context menu in picture.
});
function startFocusOut() {
$(document).on('click', function () {
$('#cntnr').hide(500); // To hide the context menu
$(document).off('click');
});
}
$('#items > li').click(function () {
$('#op').text('You have selected ' + $(this).text()); // Performing the selected function.
});
Working Fiddle here