Ali Raza
Ali Raza

Reputation: 1131

Getting value of unselect option in jQuery chosen plugin

I am not getting value of unselect option while text is getting

$('#f_profession').chosen().change(function (evt, params) {
    alert($(this).text())
    if (params.deselected) {
        alert($(this).val())
    }
});

Upvotes: 2

Views: 589

Answers (1)

Sabby Subhankar Bar
Sabby Subhankar Bar

Reputation: 26

$(document).ready(function(){
    $('#f_profession').chosen().change(function () {
        $(this).find('option:not(:selected)').each(function(){
        alert('Text : '+$(this).text());
        alert('Value : '+$(this).val());
         });
    });
});

Upvotes: 1

Related Questions