Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't play well with form fields added by client-side scripting #29

Open
o-alquimista opened this issue Jul 27, 2021 · 0 comments
Open

Comments

@o-alquimista
Copy link

o-alquimista commented Jul 27, 2021

The mask works for the first <input[class=masked]> added by scripting (on page load), but any other added later doesn't have it. The input elements come from a template. This is a simplified example:

<template id="phoneTemplate">
  <div>
    <label for="">Phone</label>
    <input type="tel" id="" name="" placeholder="99 99999-9999" class="masked" pattern="\d{2} \d{5}-\d{4}" required="required" value="">
  </div>
</template>

The empty attributes above are defined in scripting.

Here's how it looks:
Captura de tela_2021-07-27_12-17-28

Here's a fiddle that reproduces it: https://jsfiddle.net/43h9vkot/8/
I'm working on a solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant