select - jquery chosen: how to onClick for a special option -
i'm using jquery chosen create multiple select box. problem is, third option must open new window , must not select. (later user can create new option in window)
can me realize this? idea use $('.chosen-select').on('change'...)
, remove selected item list. don't know how
<div class="wrapper"> <select data-placeholder="options" style="width:350px;" multiple class="chosen-select"> <option value=""></option> <option value="1">1</option> <option value="2">2</option> <option value="3" onclick="openpopup()">3</option> </select> </div>
thank you!
if understood right should solve problem:
$('.chosen-select').on('mouseup', function(){ // on finish click on part of multiselect if($(this).val().indexof('3') !== -1){ // if value has 3 selected [1,3] openpopup(); // open popup } });
but if want work on option 3 can this
$('.chosen-select').on('mouseup','.openpopup', function(){ // on finish click on option of class openpopup if($(this).val() == 3){ openpopup(); // open popup } });
as removal:
$('.chosen-select').on('mouseup','.openpopup', function(){ // on finish click on option of class openpopup if($(this).val() == 3){ openpopup($(this)); // open popup } }); function openpopup(obj){ //popup functions... obj.remove(); }
this should solve problem
Comments
Post a Comment