I am generating dynamic radio buttons from an array being returned from a service. Each item being returned contains address data. I know how to get the value fro the data, but how can I get all the values from the item that’s selected? Here’s what I have so far:
function showAddresses(item) {
window.addNo2 = item.streetno;
window.addStr2 = item.streetname;
window.addCity2 = item.city;
window.addSt2 = item.state;
window.addZip2 = item.zip;
window.latLong2 = item.latlng;
$('#multiAdds').show();
$('#results').append('<p><input type="radio" name="multiAdds" class="radioButton" onclick="getChecked()" value="' + latLong2 + '">' + addNo2 + ' ' + addStr2 + </p>');
}
function getChecked(){
var latLong2 = $("input[name=multiAdds]:radio:checked").val();
getJurisdictionMulti(latLong2, addNo2, addStr2, addCity2, addSt2, addZip2);
}
I basically need to be able to grab all the associated address data from the selected radio button and create separate variables with them to be able to pass into my getJurisdictionMulti() function.
You can use HTML-5 data-* Attributes for such cases..
Here is a simple case( Rough Example) , which can still be optimized..
Let’s call this attribute data-custom