[jQuery] Re: Problem traversing up list

2009-11-27 Thread Vincent Robert
$('#item1-1').parent().closest('li').attr('id') will be faster because it won't retrieve the full list of parents On 27 nov, 13:20, Michel Belleville wrote: > Well, that must mean that the parent has no id, which is exactly the case : > > >     Item 1 <= $('#item1-1').parent().parent() >      

Re: [jQuery] Re: Functions

2009-11-19 Thread Vincent Robert
What you are looking for is "event delegation". In your last version, you are attaching a "click" event handler to every you add to your table. It can be time and resource consuming. A better way is to bind the "click" event to the container where you will load your dynamic content and wait for

[jQuery] Re: XHTML or HTML when creating elements?

2009-09-25 Thread Vincent Robert
Actually, jQuery does some parsing by itself first. The $('') syntax is actually a shortcut to document.createElement("span"), and yes, the "/" is required here. So $ ('') will be faster than $('') which will have to go through innerHtml. Regards, On Sep 24, 6:33 pm, Bertilo Wennergren wrote:

[jQuery] Re: can someone translate this syntax ?

2009-06-05 Thread Vincent Robert
options = $.extend({ ... }, options) is a popular construct in plugins. It allows to define default values for a options hash that is passed as the only parameter. On Jun 5, 4:22 am, runrunforest wrote: > thank you, I don't see that in other plugin, acutually so far i've not > yet see the same

[jQuery] Re: A better way of writing this code?

2009-05-15 Thread Vincent Robert
On May 15, 3:24 pm, "ryan.j" wrote: > as rob said, unless the OP is using the anchor's class itself in > conjunction with some other jquery selector at that point, the OP > would be better off just using :hover. > > jquery is awesome, but using it to do stuff CSS already does better is > conside

[jQuery] Re: Wouldn't inArray() be more intuitive if called arrayPosition()?

2009-03-24 Thread Vincent Robert
Or the name could be changed for jQuery 1.4 and a plugin provided for the compatibility with 1.3 code. It has been the jQuery policy for some time now. On Mar 24, 5:25 pm, Eric Garside wrote: > Yea, the backwards compatibility is really the major issue with making > a basically cosmetic change.

[jQuery] Re: Is there anyway to grab the Children of an Element?

2009-03-19 Thread Vincent Robert
In your livequery callback, this is the DOM object that received the event so your "th.name". $(this) builds a jQuery around this DOM element, a jQuery around your "th.name". $(this).children("th.name") returns a jQuery containing the children of "th.name" that are "th" elements and have a class

[jQuery] Re: Select links that end in .png, .jpg or .gif

2009-01-18 Thread Vincent Robert
If you want to be able to easily change the extension list, I suggest refactoring the whole thing : function getLinkExtensionsSelector(extensions) { return jQuery.map(extensions, function(ext){ return 'a[href$=.'+ext +']'; }).join(','); } var $links = jQuery('.post').find(getLinkExtensionsSe

[jQuery] Re: My toggleClass is not working.

2009-01-07 Thread Vincent Robert
toggleClass() takes a class name as argument, not a selector. $(document).ready(function() { $("a").filter("#click").click(function(){ $("div .six").toggleClass("two"); }).end() }); On Jan 6, 10:20 pm, amuhlou wrote: > In your script it appears that you are try

[jQuery] Re: Refactoring problem with jquery-selectors

2008-12-29 Thread Vincent Robert
If you just want to use your function without changing the signature, you have to pass along the current this when calling your function. This is done using the call function JavaScript provides for functions. function addClickHandler(tableId, functionName, myUrl) { jQuery('#' + tableId

[jQuery] Re: What am I doing wrong here -- htmlTo?

2008-12-18 Thread Vincent Robert
What you want in full jQuery is: $("#foo").empty().append(''); which is the exact equivalent of $("#foo").html(''); // html() does call this.empty().append() It is very different from the browser innerHtml since your HTML will first be parsed by jQuery into a DOM tree while innerHtml just inse

[jQuery] Re: Cross domain problems

2008-07-10 Thread Vincent Robert
I may be misunderstading something here but this does not look like a cross-domain issue to me. If you are making AJAX request on the same server that served the page, then you should use absolute URI path without any protocol nor domain name : $.get("/some/web/service"). This will work whatever

[jQuery] Re: Running script onLoad instead of ready

2008-07-10 Thread Vincent Robert
If you want code to execute before the page is ready, the you should just inline it in your tag. Note that you won't be able to access or modify any DOM component of the page, all you can do is append some new DOM nodes at the beginning.