John Resig wrote:
> The problem has more to do with the fact that you're doing two things wrong:
> 1) You're setting focus to a element... which is unfocusable.
> 2) You're setting focus to the element before you ever finish the focus
> function of the previous element - creating an infinite loop
The problem has more to do with the fact that you're doing two things wrong:
1) You're setting focus to a element... which is unfocusable.
2) You're setting focus to the element before you ever finish the
focus function of the previous element - creating an infinite loop.
However, the following c
John Resig wrote:
> Ok, I understand your problem better now, try this:
>
Thanx for the ultrashort code, however it doesn't work with rev.206
I've set up a test page at:
http://www.webunity.nl/_test/jquery/focus.html
I got the original idea from this page, but that code is crap :)
http://www.h
Ok, I understand your problem better now, try this:
$(document).focus(function(oEvent) {
if ( $( oEvent.srcElement || oEvent.target ).ancestors(
"#test" ).length )
return true;
$('#test')[0].focus();
return false;
});
John Resig wrote:
> Hope this helps. (This is with the SVN version of jQuery)
>
Hmm, not really I am trying to do something like this:
If the event receiving the focus is not a child of another "object", set
the focus back to that "object".
As you might guess, this is for a new style lightbox :
Try .ancestors( ) or .parent( )
/christian
Webunity | Gilles van den Hoven wrote:
> I'm trying to figure something out, but i'm kinda lost in the documented
> jQuery code...
>
> Is there a way to see if an object is a child of another object?
>
> e.g. if a link is a child of a div?
>
>
>
>
Well, the obvious way would be to do this:
$("div > link")
but if you're going from the context of the link element itself, you could do:
$(this).parent("div")
Hope this helps. (This is with the SVN version of jQuery)
--John
On 8/15/06, Webunity | Gilles van den Hoven <[EMAIL PROTECTE
I'm trying to figure something out, but i'm kinda lost in the documented
jQuery code...
Is there a way to see if an object is a child of another object?
e.g. if a link is a child of a div?
based upon the outcome, i need to do something, which i am going to
share, but first i need to g