Custom Blur Event on <div> tag

$(“.aaaa”).each(function(){
var that = this;
$(this).click(function(){
$(this).text(“Clicked”);
$(document).bind(“click”,blurHandler);
});

var blurHandler = function(e){
var container = $(that);
if(!container.is(e.target) && container.has(e.target).length === 0){
container.text(“Blurred”);
$(document).unbind(“click”,blurHandler);
}

};
});

see the working example in jsfiddle

 

Leave a Reply