jquery - Materialize CSS select: Get selected value when close -
trying selected value on materialize css select element @ close.
something this:
$('input.select-dropdown').on('close', function() { console.log($(this).val()); });
just doesn't work, because shows last selected value. first time shows nothing, , next time shows selected value first time.
i supose because close action declared before asign selected value.
anyone knows if there way selected value on "close"?
thanks in advance.
update
i don't want select value jquery, want detect selected value (if option has been selected) when dropdown close.
i'm trying implement label funcionality select text input: when select opened, label goes smaller, , when select closed, if no value selected, returns initial position.
use mouse down event.
$('input.select-dropdown').on('mousedown', function() { console.log($(this).val()); });
or can try change
event. here:
$('input.select-dropdown').on('change', function() { console.log($(this).val()); });
Comments
Post a Comment