If you want .b1 remain and be deleted only .a1
$('.a1').live('click',function() { $(".b1", this).unwrap(); });
http://jsfiddle.net/PhZhY/3/
You can remove this div even if you don't know any child:
$('.a1').live('click',function() { $(".a1 :first-child").unwrap(); });
http://jsfiddle.net/PhZhY/5/
If you want to remove the .a1 div, if it did not click inside .b2 , this is what you need:
$('.a1').live('click',function() { $(".a1 :first-child").unwrap(); }); $('.b1').live('click',function() { throw "stop execution"; });
http://jsfiddle.net/PhZhY/6/
According to a comment by @Rick Calder: If you want, you can use .addClass() to change the class or .removeClass() to delete the class.
source share