Home > other >  doubleclick Not working with selectpicker boostrap class dropdown
doubleclick Not working with selectpicker boostrap class dropdown

Time:04-28

<select class= "selectpicker" id="cus_id">
<option value="654" >test1<option>
<option value="6877" >test2<option>
<option value="8687" >test3<option>
</select>


$('#cus_id ').dblclick(function() {
                        
var cus_id =this.value;
                                   
window.open("<?php echo base_url();?>tester/" cus_id );
                            
   });
                    

Here i will take the selected value cus_id to do next operation on another tab . Without selectpicker class, dblclick function works well but Here the problem comes when i put selectpicker class dblclick event won't work So sorry for my poor english

CodePudding user response:

Adding selectpicker class to the select element would not affect your double click functionality. There seems to be some other error, more likely syntax error.

I can see the html added have multiple syntax issues like missing closing option tag, the selector has space in it $('#cus_id ').

$('#cus_id').dblclick(function() {
  console.log('Calling');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select  id="cus_id">
  <option value="654">test1</option>
  <option value="6877">test1</option>
  <option value="8687">test1</option>
</select>

  • Related