-2

There are few inputs

<input id=1>
<input id=12>
<input id=14>
<input id=16>
<input id=28>

How to implode ids to a string '1,12,14,16,28'?

0

1 Answer 1

3

You can use .map() convert the input objects to an array of ids then use Array.join() to convert them to a string

var ids = $('input').map(function(){
    return this.id
}).get().join()

Demo: Fiddle

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.