devjs11 devjs11 - 8 months ago 38
jQuery Question

$('html').click()... anywhere except one element

I have a dynamically appended menu which I am removing if you click anywhere on page including the menu links itself. What I am trying to achieve is to prevent the remove if you click a specific link and that simply does not work for me. Unfortunately I cant use the delegate method, if that would help, due to old version on jquery used on client side, no option to update it.

So maybe you could suggest if there is any way to do so. Here is a quick example of mine.

$(function() {

$('.menu').append('<a href="" class="solid">Option</a> <a href="">Option</a> <a href="">Option</a>');

$('.menu a').live('click',function(){
return false;

return false;

$('html').click(function() {



and the container

<div class="menu"></div>


Maybe it will work like this

$('html').click(function(e) {                    
   if(!$('solid') )