javascript - detect string-length on paste on maxlength-set input -


this long shot, thought might ask. have text input maxlength of 100, there anyway of detecting, on paste, if user attempted paste text string length greater 100(before shortened automatically)? thanks.

$('#limitedtext').paste(function(){    if($(this).val().length > 100) {      //do somthing     }  });  <input type = "text" id = "limitedtext" maxlength = "100"> 

you remove maxlength attribute , instead add onchange listener current value , truncate 100.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -