Good Evening All!
I have a quick question, how do I convert the following two scripts to work using a datalist? I currently have it set up to function on a select/drop down, but have since discovered the datalist version of drop downs and it suits my needs more than the select.
Using either of these does not work with the datalist.
Script One (fills inputs based one another input)
$( function() {
$("#employee_name").autocomplete({
source: "search.php",
minLength: 1,
select: function(event, ui) {
//Here $(this) points to the current autocomplete input element
$(this).closest('tr').find('input.employee_name').val(ui.item.value);
$(this).closest('tr').find('input.id').val(ui.item.id);
$(this).closest('tr').find('input.licence_number').val(ui.item.licence);
$(this).closest('tr').find('input.licence_expiry').val(ui.item.expiry);
}
});
} );
Script Two (fills an input based on a drop down’s selection)
function siteaddress(){
var address = $('#site_name').find(':selected').data('site_address');
$('#site_address').val(address);
}
Any help would be greatly appreciated!