I am redesigning the select dropdown of a site and I am using a jQuery plugin called ddSlick. However, I can't seem to capture a variable I need outside its function.
In the code below I can't seem to have the second console.log(build) show what I get in the first console.log(build). I get undefined. What could I be doing wrong?
$(document).ready(function() {
$("#demo-htmlselect").ddslick({
width: 300,
selectText: "Select an item",
onSelected: function(buildings) {
let build = buildings.selectedData.value
console.log(build);
}
});
$("#demo").ddslick({
width: 300,
selectText: "Select an item",
onSelected: function(noises) {
let nois = noises.selectedData.value
console.log(nois)
console.log(build);
}
});
});