I am trying to add some extra data using jQuerys .data() to a element on a dropdownlist, the dropdown list is populating property and the ID I want is there, but when I try and access the data is showing up and undefined.
Population code.
$.each(tutorArray, function(index, item){
var TID= item.T.Id
$.each(item.T.TimeList, function(ind, i) {
$(ddl).append($('<option></option>').val(i.StartTime).html(i.StartTime + ' - ' + i.EndTime).data({
TID: TID
}));
});
});
access code
$(ddl).bind('change', function() {
if($(this).val() != '') {
var time = $(this).val();
showConfirmRequestTutorCallDialogue(d, time, $(ddlDurationSelector).val(), $(this).data("TID"), $(ddlStudiesSelector).val())
}
});