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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -