javascript - onchange in designed select doesn't work -


i have little problem , asking if maybe can me.

i have disegned select icon each option. cool working, if try make or call onchange method select not working. if method doesn't exist! if remove desing, find , again select (without desing) , onchange method friends.

here code in case needs select:

<select id="select" class="form-control">             <option value="de" data-class="deu" id="de" selected>1</option>             <option value="en" data-class="eng" id="en">2</option>                      </select> 

with code give design select

<script> $(function() {     $.widget( "custom.iconselectmenu", $.ui.selectmenu, {       _renderitem: function( ul, item ) {         var li = $( "<li>", { text: item.label } );          if ( item.disabled ) {           li.addclass( "ui-state-disabled" );         }          $( "<span>", {           style: item.element.attr( "data-style" ),           "class": "ui-icon " + item.element.attr( "data-class" )         })           .appendto( li );          return li.appendto( ul );       }     });      $( "#select" )       .iconselectmenu()       .iconselectmenu( "menuwidget" )         .addclass( "ui-menu-icons customicons" );     }); </script>  <style>      .ui-icon.deu {       background: url("/img/de.png") 0 0 no-repeat;     }     .ui-icon.eng {       background: url("/img/gb.png") 0 0 no-repeat;     }  </style> 

and onchange

$(select).change(function(){         alert("schön!");     }); 

you forget type '#' , type in string format.

$("#select").change(function(){     alert("schön!"); }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -