Adding key/value into array where value is a object
I want to add some text as a key and Object as a value.
Example
$('#clickme').on('click' , function() {
push to array => "some_text" as (value) and $(this) as key
})
Just use a normal object which works as an associative array anyway:
var myObj = {};
$('#clickme').on('click' , function() {
myObj["some_text"] = $(this);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With