简体   繁体   中英

jquery token input mouse right click and paste not working

copy paste through mouse in jquery-token input not working but works with ctrl+v .

how to bind mouse right click to jquery token input field.

tried various ways but not working

$(document).mousedown(function(event) {
     if(event.which == 3)
       {
          $("#keywords").trigger('click');
       }
     });

  $('#keywords').on('paste',function() {
     $(this).trigger('keypress');
      });

<input class="input-xxlarge" ng-model="search_data" id="keywords">

I think instead of bind mouse right click, you should bind('input propertychange') to check any changes in the textbox.

$('#keywords').bind('input propertychange', function() {
    // make token trigger
}

I solved this by adding the .bind as shown below into my jquery.tokeninput.js file like so:

// The list to store the token items in
var token_list = $("<ul />")
    .addClass($(input).data("settings").classes.tokenList)
    .bind('paste', function() {
      setTimeout(function(){do_search();}, 5);
    })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM