I have an unordered list that I am prepending data to as follows:
jQuery("#mylist").prepend(newItem);
When the list reaches a certain size I need to remove the first item that was inserted before adding the new one.
How would I get the first item to remove based on accessing the ordered list by it’s id.
Something like:
jQuery("#mylist")[0].remove();
Thanks
Since you mentioned ordered list, im assuming #mylist contains li tags inside, thus this should work
I see you are prepending there, In case you want to remove the last element then