I have a dropdown menu "Names". Right now, Im populating it with the firstName of employees. The first names of the employees is the data which is added at run time. Now I want to display the options in the dropdown as "(firstName) (lastName)" Is there a way to do this using jquery. Im able to retrive both the firstName and lastName from the database.
Current Jquery Code for the dropdown:
$('.employeeName').prepend("<option value=''></option>").val('');
for(i=0;i<data.length;i++){
if(data[i].firstName)
$('.employeeName').append('<option>' + data[i].firstName + '</option>');
}
Aucun commentaire:
Enregistrer un commentaire