我一直在尝试获取粘贴输入的值,但它总是什么都不返回:
$('form#post-game :input[name="header"]').keyup(function(){
var str = $(this).val();
IsImageValid(str, "#post-game-img-header");
});
$(document).on('paste','form#post-game :input[name="header"]',function(e) {
var str = $('form#post-game :input[name="header"]').val();
IsImageValid(str, "#post-game-img-header"); // there is a console log in this function
});
keyup 工作正常,但粘贴没有。