The issue at hand is pretty straightforward - I have a form with the usual email setup: an Email
input along with a Confirm Email
input, where the values must match for validation.
I'm curious if it's possible to dynamically set the pattern
attribute on the Confirm Email
input to be a regex pattern that corresponds to whatever the user types into the initial Email
field during keyup or focusout events. Is this concept clear and feasible?
I can handle creating the event listeners for keyup/focusout, but I'm uncertain about crafting a suitable regex for this scenario, and whether dynamically generating the pattern attribute in this manner would actually work as intended.
Lastly, please refrain from suggesting jquery solutions, as my current project requires vanilla JavaScript implementation. ES6, typescript, etc. are acceptable alternatives, just not jquery. Thank you in advance!