0

Why do i always get "... .splice() is not a function" when using it on arrays with objects??

Does indeed work with numbers, but I need it with objects.

https://jsfiddle.net/a1nq1p73/1/

arrayWithObjects.splice(0,1); // "TypeError: ... not a function"

I am trying to rearrange sections (position:absolute) by their left property.

1 Answer 1

3

getElementsByTagName does not return an array, the method returns a live HTMLCollection of elements. You would need to convert it to an array.

var divs = document.getElementsByTagName("div");
var nowItIsAnArray = [].slice.call( divs);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.