I have a page that displays hotel data in a list. I have this data on the page:
<input type="hidden" class="name" value="Hotel1" />
<input type="hidden" class="latitude" value="-12.3456" />
<input type="hidden" class="longitude" value="12.3456" />
<input type="hidden" class="name" value="Hotel2" />
<input type="hidden" class="latitude" value="98.7654" />
<input type="hidden" class="longitude" value="-98.7654" />
I'd like to create an array of objects from those values, so that I can loop through each hotel and do something like this:
$.each(hotels, function (index, obj) {
var name = obj.name;
var lat = obj.latitude;
var long = obj.longitude;
});