$('#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()
>
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
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:
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
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
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.
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
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
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
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
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
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
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.