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