<input id="some_id" value="some_value">
I need to create {some_id: some_value} (in other words i need to use as name of the attribute value of id) from upper input.
I tried:
jQuery('[name="page-numbers[]"]').map(function () {
return { jQuery(this).attr('id'): jQuery(this).val()};
}).get();
jQuery('[name="page-numbers[]"]').map(function () {
return {this.id: this.value};
}).get();
But every time i get an error near {this.id:. If only call this.id or this.value or same jQuery – result returns.
In your case you should use square bracket notation for defined empty object: