Assume I have an Array of jQuery objects. I would like to search in array and find out such a key exists are not. NOTE: The objects are not of same pattern
Ex:
a = [ { "chart_type" : 4},
{ "x_axis" : { "field_type" : 5, "name" : "priority" } },
{ "y_axis" : { "field_type" : 3, "name" : "created_at" }}
]
I would like to search from the above, if key such as "chart_type" exists or not. If yes, I would like to get the value.
a.find("chart_type").value // Need something like this
I tried the following.
jQuery.grep(chart_hash, function(key,value){
if(key == "chart_type")
return value
});
However, the above doesn't work. Please help.