I want to iterate a JSON Object and then join/ merge each result into string.
Here is my codes:
JSON:
var jsonObj = [ {"tag": "article"}, {"tag": "header"} ]
jQUery:
var json = $.parseJSON(jsonObj);
var element = $.each(json, function(i, val){
var finder = 'find("' + val.tag + '")';
return finder;
});
alert(element);
I tried using .join() after $.each(), like this $.each(...).join(); but it is returning object.
I also using .get(), like this $.each(...).get().join(); but returning error.
What can I use to join the result returned in each iteration and then merge them and output as a string?
'find()'as a string used for? Are you wanting to invoke as function?