1

In the following code how to remove the .e_data which is greater than s_arr.topics.length For example if s_arr.topics.length = 2 and $(".e_data").length = 5 ..Then in this case want to remove the elements 3rd .e_data,4th .e_data,5 .e_data how to do this

if($(".e_data").length > s_arr.topics.length)
{
$('.e_data').last().remove();
}
asked Aug 30, 2013 at 8:47
1
  • Do you mean want to delete a tag which has length greater than s_arr.topics.length ? Commented Aug 30, 2013 at 8:53

1 Answer 1

1

You can use slice():

$(".e_data").slice(s_arr_topics.length).remove();
answered Aug 30, 2013 at 8:49

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.