Question: How to dynamically add radio buttons to a form
I am appending the radio buttons:
function addTypesButtons()
{
var params=[];
params.table='TB_TYPES_ADDRESS';
params.field='TYPES_ADDRESS_NAME';
$.getJSON("php/CoJ_getTypesNames.php", $.param(params, true) , function(data) {
$.each(data, function(index, element)
{
if (index==0)
{
$('#aTypes').append($('<input>', {
type:"radio", class:"toggle", disabled:true, name:"addresstypes", onclick:"AddressTypeClick("+index+1+")",
tabindex:1, id:"addresstypeshome", checked:true, value:element[params.field]})+element[params.field]+'<br/>');
}
else
{
$('#aTypes').append($('<input>', {
type:"radio", class:"toggle", disabled:true, name:"addresstypes", onclick:"AddressTypeClick("+index+1+")",
tabindex:1, id:"addresstypeswork", value:element[params.field]})+element[params.field]);
}
}
); });
}
I expect to get two radio buttons like this:
Home
Work
What I really get is what the top of the image shows:
This should show on the form like the bottom of the image:
Types http://www.greatdaydan.com/Types.png
How do I get just the text without the " [object Object]"?