0

Is there a way to add masked input plugin on dynamically loaded contents? something like $("document").on("mask", "mask('(999) 999-9999')")?

Currently Im using $.getScript(), but sometimes it fails to load at all...

Thanks!

Sparky
  • 98,165
  • 25
  • 199
  • 285
Pa3k.m
  • 994
  • 2
  • 7
  • 22
  • You just need to ensure that when the dynamic content is added, you call `.mask` on the added input elements – Brennan Sep 29 '14 at 22:07
  • @Brennan thats what Im currently doing, using `$.getScript('/js/masked.js');` to load the mask. However, the masked.js sometimes doesnt load making it unreliable. Is there a way maybe to make sure that $.getScript didnt fail? – Pa3k.m Sep 29 '14 at 22:12
  • Why are you using getScript and not just including your script in the head of the page? – Brennan Sep 29 '14 at 22:14
  • Cause Im only loading a portion of the page. – Pa3k.m Sep 29 '14 at 22:18
  • But you can include the script in the head of whatever page you need to use the mask in. I'm not sure I follow the problem – Brennan Sep 29 '14 at 22:19

0 Answers0