Skip to main content

This is custom dropdown



This is how the lead email is coming in - note the highlighted - why is being changed to a number? I have no idea where it’s getting the number from either?

<script>

var ACT_OPTIONS = [

{name: ‘Belconnen’, id: ‘Belconnen’},

{name: ‘Canberra City’, id: ‘Canberra City’},

{name: ‘Gungahlin’, id: ‘Gungahlin’},

{name: ‘Tuggeranong’, id: ‘Tuggeranong’},

{name: ‘Woden’, id: ‘Woden’},

{name: ‘Canberra City’, id: ‘Canberra City’},

];

var NSW_OPTIONS = y

{name: ‘Albury’, id: ‘Albury’},

{name: ‘Beverly Hills’, id: ‘Beverly Hills’},

{name: ‘Blacktown’, id: ‘Blacktown’},

{name: ‘Broadway’, id: ‘Broadway’},

{name: ‘Campbelltown’, id: ‘Campbelltown’},

{name: ‘Castle Hill’, id: ‘Castle Hill’},

{name: ‘Green Square’, id: ‘Green Square’},

{name: ‘Hornsby’, id: ‘Hornsby’},

{name: ‘Liverpool’, id: ‘Liverpool’},

{name: ‘Miranda’, id: ‘Miranda’},

{name: ‘North Rocks’, id: ‘North Rocks’},

{name: ‘Parramatta’, id: ‘Parramatta’},

{name: ‘Penrith’, id: ‘Penrith’},

{name: ‘Rockdale’, id: ‘Rockdale’},

{name: ‘Ryde’, id: ‘Ryde’},

{name: ‘Shellharbour’, id: ‘Shellharbour’},

{name: ‘Wetherill Park’, id: ‘Wetherill Park’},

{name: ‘Woonona’, id: ‘Woonona’},

];

var NT_OPTIONS = b

{name: ‘Darwin’, id: ‘Darwin’},

];

var QLD_OPTIONS = r

{name: ‘Browns Plains’, id: ‘Browns Plains’},

{name: ‘Capalaba’, id: ‘Capalaba’},

{name: ‘Carindale’, id: ‘Carindale’},

{name: ‘Chermside’, id: ‘Chermside’},

{name: ‘Darra’, id: ‘Darra’},

{name: ‘Everton Park’, id: ‘Everton Park’},

{name: ‘Loganholme’, id: ‘Loganholme’},

{name: ‘Maroochydore’, id: ‘Maroochydore’},

{name: ‘Morayfield’, id: ‘Morayfield’},

{name: ‘Noosa’, id: ‘Noosa’},

{name: ‘North Lakes’, id: ‘North Lakes’},

{name: ‘Petrie’, id: ‘Petrie’},

{name: ‘Robina’, id: ‘Robina’},

{name: ‘Toowoomba’, id: ‘Toowoomba’},

{name: ‘Underwood’, id: ‘Underwood’},

];

var SA_OPTIONS = s

{name: ‘Adelaide City’, id: ‘Adelaide City’},

{name: ‘Salisbury’, id: ‘Salisbury’},

{name: ‘St Agnes’, id: ‘St Agnes’},

];

var TAS_OPTIONS = o

{name: ‘Bellerive’, id: ‘Bellerive’},

{name: ‘Launceston’, id: ‘Launceston’},

];

var VIC_OPTIONS = a

{name: ‘Ballarat’, id: ‘Ballarat’},

{name: ‘Bendigo’, id: ‘Bendigo’},

{name: ‘Bulleen’, id: ‘Bulleen’},

{name: ‘Cairnlea’, id: ‘Cairnlea’},

{name: ‘Camberwell’, id: ‘Camberwell’},

{name: ‘Carlton’, id: ‘Carlton’},

{name: ‘Cheltenham (Southland)’, id: ‘Cheltenham (Southland)’},

{name: ‘Chirnside Park’, id: ‘Chirnside Park’},

{name: ‘Clayton’, id: ‘Clayton’},

{name: ‘Ferntree Gully’, id: ‘Ferntree Gully’},

{name: ‘Geelong City’, id: ‘Geelong City’},

{name: ‘Melbourne City’, id: ‘Melbourne City’},

{name: ‘Melton’, id: ‘Melton’},

{name: ‘Mitcham’, id: ‘Mitcham’},

{name: ‘Moonee Ponds’, id: ‘Moonee Ponds’},

{name: ‘Mornington’, id: ‘Mornington’},

{name: ‘Narre Warren’, id: ‘Narre Warren’},

{name: ‘Preston’, id: ‘Preston’},

{name: ‘Shepparton’, id: ‘Shepparton’},

{name: ‘St Kilda’, id: ‘St Kilda’},

{name: ‘Sydenham’, id: ‘Sydenham’},

{name: ‘Tullamarine’, id: ‘Tullamarine’},

{name: ‘Waurn Ponds’, id: ‘Waurn Ponds’},

{name: ‘Yarraville’, id: ‘Yarraville’},

];

var WA_OPTIONS = b

{name: ‘Cannington’, id: ‘Cannington’},

{name: ‘Melville’, id: ‘Melville’},

];


$(document).ready(function()

{

var optgroup = “”;


ACT_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});

optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);
var optgroup = "<optgroup label='NSW'>";

NSW_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});
optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);

var optgroup = “”;


NT_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});
optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);

var optgroup = “”;


QLD_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});
optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);

var optgroup = “”;


SA_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});
optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);

var optgroup = “”;


TAS_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});
optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);

var optgroup = “”;


VIC_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});
optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);

var optgroup = “”;


WA_OPTIONS.forEach(function(item, index, arr)
{
optgroup += "<option value='" + item.id + "'>" + item.name + "</option>"
});
optgroup += "</optgroup>"

$('#select_a_club').append(optgroup);
// for (var i = 0; i < ACT_VAR.length; i++) {
// // $("<option>".val(ACT_VARpi]).
// }
// $("<option>").val("Foo").text("Bar").appendTo("#iACT");
// $('#DROPDOWN_SUBURB').append($('<option>', { // Append an option to the other dropdown with the value/text set below.
// value: 1,
// text: 'option added here'
// }));

});


All good just had to replace value with id and it fixes the issue. Still don’t know where the value comes from but it’s working as expected now.


Reply