I wrote this code :
$("input").on("paste", async function () {
await sleep(100);
});
// Copy paste delay
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
On desktop, it works but on mobile, paste doesn’t work (I mean validation doesn’t work when I paste in input). How do I make it work?
You can use
$(this).bind('paste',async function () {
await sleep(100)
const valid = $(this).valid();
if ($(this).attr('websitePassword') !== undefined) {
validatePassword($(this));
valid ? $('.invalid-feedback--list').hide() : $('.invalid-feedback--list').show();
}
changeValidationDesign($(this));
});