0

From the following jQuery command I get several input elements:

$("#main :input")

Now I need those elements as a normal JavaScript array with the normal DOM elements.

In order to get this, do I have to create this array by myself using:

var normalList = [];
$("#main :input").each(function() {
  normalList.push(this);
})

or is there some shorter way?

Thanks alot in advance

2

1 Answer 1

3
var sweetArray = [].slice.call($("#main :input"));

Here you go.

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.