how do I turn this
<input class="optionsGraph" name="name1" value="value1">
<input class="optionsGraph" name="name2" value="value2">
<input class="optionsGraph" name="name3" value="value3">
<input class="optionsGraph" name="name4" value="value4">
<input class="optionsGraph" name="name5" value="value5">
into this (with a loop)?
var example = [
{ label: "name1", y: value1, x: 1 },
{ label: "name2", y: value2, x: 2 },
{ label: "name3", y: value3, x: 3 },
{ label: "name4", y: value4, x: 4 },
{ label: "name5", y: value5, x: 5 }
];
I was thinking with something like this?
$(".optionsGraph").each(function(key) {
//another loop
});
I'm really struggling with this