[jQuery] Re: Forced bubbling

2009-03-23 Thread John Resig
Why not do:
$('#first').click(function(e) { e.preventDefault(); });

--John


On Mon, Mar 23, 2009 at 9:20 AM, John Smith master9...@gmail.com wrote:


 I have 2 containers

 i disabled event bubbling for first container. This is must have  $
 ('#first').click(function() { return false; });

 Now i need to detect if user clicked outside #second container $
 (document).click(function () { alert('clicked somewhere'); });

 Clicking on #first doesn't show me alert. Is there any way to force
 bubbling??. I cant add this alert to #first click, because there can
 be 1000 that kind of elements.


[jQuery] Re: Forced bubbling

2009-03-23 Thread John Smith

In my case i need prevent bubbling. Guess there arent any way to do
what i need :(


[jQuery] Re: Forced bubbling

2009-03-23 Thread Karl Swedberg


On Mar 23, 2009, at 5:32 PM, John Smith wrote:



In my case i need prevent bubbling. Guess there arent any way to do
what i need :(


sure there is. to prevent bubbling, use event.stopPropagation();

http://docs.jquery.com/Events/jQuery.Event#event.stopPropagation.28.29

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com