Wanting2LearnMan
asked on
Add dropdown box to html table using javascript help
I have a custom javascript handler that when a button is pressed it appends a row to a html table like so:
This is working fine.
Now I want to modify this so that adds a dropdown box and adds some items to this dropdown box.
SO I have added the following line
Now this adds the dropdown box but it does not iinsert the "item1" into it??
What am I doing wrong??
Thanks
$(table).append(
'<tr><td><input class="SettingsListField save_pending" type="text" ' +
'id="' + $(this).attr('id') + '_' + newIndex + '" name="' + $(this).attr('id') + '"></td>'+
'<td><input class="SettingsListField save_pending" type="text" ' +
'id="' + $(this).attr('id') + '_' + newIndex + '" name="' + $(this).attr('id') + '"></td>'+
'<td><div class="SettingsIconContainer"><a class="InputListbtnRemove" onclick="return false;">'+
'<img src="/static_media/img/RemoveButton2_small.png" alt="Remove address details" /></a></div></td>'+
'<td><div class="SettingsStatusContainer" id="' + $(this).attr('id') + '_' + newIndex + '_status"></div></td>'+
'</tr>'
);
This is working fine.
Now I want to modify this so that adds a dropdown box and adds some items to this dropdown box.
SO I have added the following line
'<td><select class="CustomSelect1 not_changed" id="' + $(this).attr('id') + '_' + newIndex + '" name="' + $(this).attr('id') + '" <option>"item1"</option>></td>'+
Now this adds the dropdown box but it does not iinsert the "item1" into it??
What am I doing wrong??
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have another question related to this appearing soon.