tags:

views:

31

answers:

2

Hi, With the fallowing code I want to delete the last element inside the steps variable,

var steps = $(element).find("fieldset");
var count = steps.size();
steps[count-1] = null;

but when I iterate with the each method, it doesn't seems to see the null value

steps.each(function(i) {
});
+1  A: 

Use the slice function

steps = steps.slice(0, -1);
Rafael
A: 

You could use not() to create a new jQuery object removing the elements you don't want:

steps = steps.not(steps.last());
Andy E