Rob Wilkerson schrieb:
Ah, that's what I was looking for. I knew about jQuery's
chainability, but being more familiar with the Java world, I'm not
used to chaining completely unrelated actions. That's really cool.
Maybe it helps to see how the jQuery would look like when implemented in
You can use .each().
$(#myId).each(function() {
// do lots of stuff
});
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
Not exactly, to add to Chris's comment, using:
$(myele).each(function() {
// do lots of stuff
});
will scope the 'this' keyword to whatever you've selected using $('myele').
So, for example, if I had:
with(document.getElementById(myele)) {
// myele now part of scope chain, no variable
I knew about each(), but since I had only one element it seemed...I
don't know...almost like overkill. I was hoping there would be
something like:
$('myele').do (
/** do stuff */
);
But, that having been said, I guess each() is effectively that. Maybe
it's only the semantics of it that
If it is just one element you can do:
var myelem = $('#myelem')[0];
Because the jQuery wrapper acts like an array you can just grab the
first element of the array, which is the raw DOM element.
Another thing to keep in mind is jQuery's chainability. So while
it's not so efficient to deal with
Ah, that's what I was looking for. I knew about jQuery's
chainability, but being more familiar with the Java world, I'm not
used to chaining completely unrelated actions. That's really cool.
Thanks again.
On 3/8/07, Karl Rudd [EMAIL PROTECTED] wrote:
If it is just one element you can do: