Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Blair Mitchelmore
That would require a change in the moveCodeToImg function. A naive example would be: function moveCodeToImg(element) { // Catch $().each() calls of the function if (typeof element == 'number') element = this; // do stuff to element } -blair Abel Tamayo wrote: > Wow, thanks everyone

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Blair McKenzie
Each takes a function as a parameter. Generally people just pass in an anonymous function (e.g. $('.oneclass').each(function(i) {}); ) but there is no reason you can't pass in a function you defined previously (e.g. $('.oneclass').each(fmoveCodeToImg); ). So, each has a function. When it runs, it

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Abel Tamayo
Wow, thanks everyone for the superfast response. Ok, as Brandon suggested, the right way was using $('.oneClass').each(function() { moveCodeToImg(this); }); wich I had already tried but didn't realize i had to change some things in the function used since i was recycling it and the parameters an

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Brandon Aaron
On 12/18/06, Mike Alsup <[EMAIL PROTECTED]> wrote: > > shouldn't be called. You could write it like this: > > > > $('.oneClass').each(function() { moveCodeToImg(this); }); > > I was thinking of this: > > $('.oneClass').each(moveCodeToImg); Indeed, it would be cleaner ... just make sure the moveCod

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Aaron Heimlich
On 12/18/06, Brandon Aaron <[EMAIL PROTECTED]> wrote: To just expound on what Mike mentioned ... by saying, 'moveCodeToImg(this)' you are trying to call a function where it shouldn't be called. You could write it like this: $('.oneClass').each(function() { moveCodeToImg(this); }); pffft...sho

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Mike Alsup
> shouldn't be called. You could write it like this: > > $('.oneClass').each(function() { moveCodeToImg(this); }); I was thinking of this: $('.oneClass').each(moveCodeToImg); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Aaron Heimlich
Can you give any more details on the exception? (file, line number, etc). Perhaps a link to the page you're working on as well? Inside each(), "this" is a DOM object (which ever one is currently being iterated over), so I believe your code should work. On 12/18/06, Abel Tamayo <[EMAIL PROTECTED

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Brandon Aaron
On 12/18/06, Abel Tamayo <[EMAIL PROTECTED]> wrote: > $(".oneClass").each(moveCodeToImg(this)) To just expound on what Mike mentioned ... by saying, 'moveCodeToImg(this)' you are trying to call a function where it shouldn't be called. You could write it like this: $('.oneClass').each(function() {

Re: [jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Mike Alsup
> $(".oneClass").each(moveCodeToImg(this)) Don't try to pass 'this' into the function. It will be set for you. The arg passed into your function will actually be an index. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/

[jQuery] DOM traversing then applying a non JQuery function

2006-12-18 Thread Abel Tamayo
Alright. I have a non Jquery function called myFunction(domObject) prepared to receive a DOM object as a parameter. I want to use this function with several objects that share the same class, so i use a sentence like this in the main page: $(".oneClass").each(moveCodeToImg(this)) , but it doesn'