Append div before last child in jQuery 1.3

I am using jquery 1.3. (x) (I do not remember the exact name of the version).
I have a holder variable containing elements.
I would like to add a div at position n-1 inside the holder.
In jquery 1.4, I can do holder.children().last().before('<div />'); .
How can I do this with jquery 1.3?

+7
source share
1 answer

Try the following:

 $("<div>New DIV</div>").insertBefore($(":last-child", holder)); 

Working example: http://jsfiddle.net/Chandu/u94gV/

+12
source

All Articles