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);
});
var value = myObj["some_text"];
$(this).data(value)? See api.jquery.com/data and api.jquery.com/jQuery.data