[jQuery] Re: Move element to parent div

2009-05-19 Thread Richard D. Worth
What does your html look like? Is .mydivcontainer the immediate parent of .mydiv? - Richard On Tue, May 19, 2009 at 7:20 AM, aly he...@digitalnature.ro wrote: I'm trying to move a set of divs into their parent elements. Currently I'm using: jQuery('.mydiv').each(function(){

[jQuery] Re: Move element to parent div

2009-05-19 Thread Richard D. Worth
And what is it you're trying to do exactly? I have to say I was caught curious by your subject 'Move element to parent div'. Where would an element be, if not inside its parent? Are you just trying to move it up to be the first child of the parent, by prependTo? I wonder if in the first case,

[jQuery] Re: Move element to parent div

2009-05-19 Thread aly
thanks for your reply. html is something like: div class=mydivcontainer ... div class=mydiv ... /div /div there are more elements where I placed the (...) dots, but I guess it doesn't matter since parent('.mydivcontainer') should locate the target element. and yes, what I am trying

[jQuery] Re: Move element to parent div

2009-05-19 Thread Richard D. Worth
On Tue, May 19, 2009 at 10:48 AM, aly he...@digitalnature.ro wrote: thanks for your reply. html is something like: div class=mydivcontainer ... div class=mydiv ... /div /div there are more elements where I placed the (...) dots, but I guess it doesn't matter since

[jQuery] Re: Move element to parent div

2009-05-19 Thread aly
it seems that parent('...') is the problem... the code works only if I specify the name of the target div: jQuery(document).ready(function(){ jQuery(.mydivcontainer).prependTo('.mydiv''); }); but this is useless in my case because I have multiple and dynamic items with that class...

[jQuery] Re: Move element to parent div

2009-05-19 Thread Richard D. Worth
How about (untested): $(this).parent().prepend(this) ? - Richard On Tue, May 19, 2009 at 1:29 PM, aly he...@digitalnature.ro wrote: it seems that parent('...') is the problem... the code works only if I specify the name of the target div: jQuery(document).ready(function(){

[jQuery] Re: Move element to parent div

2009-05-19 Thread aly
doesnt work. I get: Error: [Exception... Node cannot be inserted at the specified point in the hierarchy code: 3 . On 19 Mai, 20:43, Richard D. Worth rdwo...@gmail.com wrote: How about (untested): $(this).parent().prepend(this) ? - Richard On Tue, May 19, 2009 at 1:29 PM, aly

[jQuery] Re: Move element to parent div

2009-05-19 Thread aly
found it: jQuery(this).prependTo(this.parentNode) works! thanks On 19 Mai, 20:43, Richard D. Worth rdwo...@gmail.com wrote: How about (untested): $(this).parent().prepend(this) ? - Richard On Tue, May 19, 2009 at 1:29 PM, aly he...@digitalnature.ro wrote: it seems that