igorescobar / jQuery-Mask-Plugin

A jQuery Plugin to make masks on form fields and HTML elements.
http://igorescobar.github.io/jQuery-Mask-Plugin/
Other
4.77k stars 1.42k forks source link

Problems with setting translation and mask dynamically #698

Closed mrdo23 closed 5 years ago

mrdo23 commented 5 years ago

i'm having issues with setting a mask and translation dynamically. the original aim would have been to set these via HTML notation but am i right in saying that i cannot set a translation that way?

currently, i'm using jQuery to pick up the mask and translation values via data attributes and to then apply these dynamically.

unfortunately, only the first element behaves as expected - is there a simpler way to do this? it looks like the fact that some textboxes have no value (i.e value) seems to be causing the issue.

i also have an issue where nothing happens on the first event - click or paste. etc is there a way to set the mask without relying on a user event?

also, i get strange behaviour when pasting values in directly using the mouse only. nothing appears on the first paste and then i get strange text on the second paste - any ideas?

fiddle here:

http://jsfiddle.net/L6gb5tvy/2/

thanks in advance!

mrdo23 commented 5 years ago

Looks to have possibly been a keyword error due to my options being called options. All working now.