horprogs / Just-validate

Modern, simple, lightweight (~5kb gzip) form validation library written in Typescript, with no dependencies (no JQuery!). Support a wide range of predefined rules, async, files, dates validation, custom error messages and styles, localization. Support writing custom rules and plugins.

Home Page:https://just-validate.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when input hidden deal with script

yewon97 opened this issue · comments

Hello.

<input type="hidden" name="test" value="" />
if i validate this input,
but I update the value using script like $("[name=test]").val('something');

However, the error message does not work dynamically when controlled by script like that.
Maybe it's because it's only supposed to work in events such as input, change, keyup, etc.
Is there any way to solve the above method?

Hey, you are right. I guess you could use this workaround https://stackoverflow.com/questions/3179385/val-doesnt-trigger-change-in-jquery like

$("[name=test]").val('something').trigger("change");