I want to show overlay over div. After showing the overlay, I do not want to let this background div be selected. But when I double-click on the overlay, that background div is in a select state. Can you please take a look at this. http://jsfiddle.net/fkWn5/2/
Decision
You can do this using user selection rules in css and adding this class to the background element after enabling overlay:
CSS
.unselectable { -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; }
adding a class using jquery:
$('#backgrounddiv').addClass('unselectable');
Jsfiddle example:
Literature:
$(document).ready(function() { $('#search_name').on('keyup', function() { search_name = $(this).val(); $("#names li:contains('" + search_name + "')").addClass('highlight').siblings().removeClass('highlight'); }); });