diff --git a/src/inject.js b/src/inject.js index c2563f5..845c52b 100644 --- a/src/inject.js +++ b/src/inject.js @@ -411,6 +411,11 @@ el.dispatchEvent(new Event(eventName, { bubbles: true })); } + // truncate the value if required by the field + if (el.maxLength > 0) { + value = value.substr(0, el.maxLength); + } + // Set the field value let initialValue = el.value || el.getAttribute("value"); el.setAttribute("value", value);