jQuery masking working with jQuery 1.5 but not https://code.jquery.com/jquery.js

StackOverflow https://stackoverflow.com/questions/21170468

  •  28-09-2022
  •  | 
  •  

문제

So I am building a simple form that is using the bootstrap. Bootstrap wants to reference https://code.jquery.com/jquery.js as its core jQuery. When I reference that my bootstrap works but not my masking. It baulks at

 $(".phone").mask is not a function

If i change the jQuery reference to ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js it works just fine. I need them both to run on the same library. Any thoughts on what is hanging up the filter? It works for the validation just not the masking. Thanks!

Test Page: http://iupui.edu/~ofapd/registration/indexDirect.php?id=1165

도움이 되었습니까?

해결책

All rights. See in js/jquery.maskedinput.js:

 var pasteEventName = ($.browser.msie ? 'paste' : 'input') + ".mask";
 // TypeError: $.browser is undefined

See here jQuery Core 1.9 Upgrade Guide. Since 1.9 $.browser is removed. In first case https://code.jquery.com/jquery.js you loading 1.10 - it doesnt work. But in second 1.5 - its works. Read about migration and compatibility.

다른 팁

The linked test site appears to be using an old version of jquery.maskedinput.js (1.2.2) which is not compatible with later versions of jQuery. Try the latest version (currently 1.3.1).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top