Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Create an objects with input value

$
0
0

I have the various number of input like that. I do not control the exact numbers of inputs as they are coming from backend

<input value="User"><input value="email@mail.com"><input value="Adress">

My task is to grab all values from inputs and put them into object. Object is look like that

contactDetails = {username, mail, adress}

So no matter how many inputs I have 3 input values assigning to object keys and if there another 3 inputs they go to separate object with the same key values so in the end it should look like that

   {"username": "User","mail": "email@mail.com","adress": "Adress",    },    {"username": "User 2","mail": "email@mail.com 2","adress": "Adress 2",    },

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>