Hi again. :)
This should help you understand what :eq() does:
http://docs.jquery.com/Selectors/eq#index
"Matches a single element by its [zero-based] index."
I'm sure we can achieve what you're trying to do, but it's hard for me
to help without being able to at least see the HTML. As it is, I don't
know what .qz-tablefield is, for example. Can you point me to a web
page or even just provide an HTML snippet?
Thanks,
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Feb 11, 2008, at 3:07 PM, Feijó wrote:
Hi Karl,
Its a bit more confunsing, I simplified too much
In my div, I change a value from a <select>
that triggers a code that clone the <select> parent (the div)
If I do that a few times, every new div goes to the bottom
I do not know what eq() is!! there is a function that return that?
Here is a sample of current code:
$("#thefilter img#new-criteria").click(function(){
$last = $('#thefilter .qz-tablefield:eq(1)')
.clone(true);
$last
.appendTo($('#qz-criteria'))
.hide()
.fadeIn('medium')
.find('.clean-criteria')
.trigger('click');
});
my <select> triggers that event. How to adjust with your suggestion?
Feijó
Karl Swedberg escreveu:
Hi Feijó,
you could try this ...
$('div.main > div.sub:eq(2)').after('<div class="sub"></div>');
That should insert your new div after the 3rd one.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Feb 11, 2008, at 2:25 PM, Feijó wrote:
consider that html:
<div class=main>
<div class=sub></div>
<div class=sub></div>
<div class=sub></div>
<div class=sub></div>
<div class=sub></div>
</div>
I need to append a new <div class=sub></div> as the 2nd, 3rd,
middle, etc.
Append() add after the last one.
How can I do that? Its possible?
Thanks
Feijó