jQuery Event Delegation input type keyup blur -


$('#item_code_wrapper').on('keyup blur', '#item_code', function(){              if( $(this).val() != ""){                  $.ajax({                     url : "../item/code/" + $(this).val(),                     success: function(data){                          if (data.success == 'false') {                             $('#item_description option').removeattr('selected');                         }else{                             $('#item_description option:eq(' + data.item_id + ')').attr('selected', true);                         }                      }                 });              }          }); 

this 1 works if copy , paste code. points option item id , remove selected if data success false. again, if manually type item code , has matching id changes option selected doesn't point particular option.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -