I\'m trying to set the maxlength on input fields dynamically using JavaScript. Apparently that is a problem in IE, and I found part of the solution.
$(\"inpu
All the answers here relies on keypress/paste events. Here is my solution using the input event:
input
$('input').on('input', onInput); var inputValue = ''; function onInput(e) { if(e.currentTarget.value.length > 30) { e.currentTarget.value = titleValue; return; } inputValue = e.currentTarget.value; }