Closed ebiasini closed 10 years ago
This is because .on only can bind to elements that already exist on the page. SlickNav creates the new element and inserts it into the DOM so you will have to modify the code a bit.
$(document).on('change', '.switcher', function () {
var url = $(this).val(); // get selected value
if (url) { // require a URL
window.location = url; // redirect
}
return false;
});
We are trying to make slicknav load a subsitute for a select which fires the page change using the following code:
$('.switcher').on('change', function () { var url = $(this).val(); // get selected value if (url) { // require a URL window.location = url; // redirect } return false; });
Even though slicknav gets the same class as it's original counterpart, the change event doesn't seem to occur, so the page doesn't change.