Trying to use Robin Herbots Inputmask module, and can't get it working. Looking at all the other similar posts, a common problem to make sure the docment.ready function has a call to inputmask(), but this looks good to me.
Scripts
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
<script src="/js/jquery.inputmask.js">
<script src="/js/mainReady-client.js">
<script src="/js/bootstrap.min.js">
mainReady-client.js
$(document).ready(function() {
$(":input").inputmask();
});
HTML
<td>
<input value="10" data-inputmask="'mask': '999'">
</td>
I've tried:
$(document).ready(function() {
$("#currIN").inputmask("9999");
});
or (the real one I want - currency)...
$(document).ready(function() {
$("#currIN").inputmask("'alias': 'numeric', 'groupSeparator': ',', 'autoGroup': true, 'digits': 2, 'digitsOptional': false, 'prefix': '$ ', 'placeholder': '0'");
});
and then:
<td>
<input value="10" id="currIN">
</td>
It seems so simple yet nothing happens. It has to be the order that I load things, but it all looks good. Thanks for any help. Cheers.
Try to use this inputmask script,
<script type='text/javascript' src="https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js"></script>
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.11.0.js'></script>
<script type='text/javascript' src="https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js"></script>
<script type='text/javascript'>
//<![CDATA[
$(window).load(function(){
$("#currIN").inputmask("9999");
});
//]]>
</script>
</head>
<body>
<td>
<input value="10" id="currIN">
</td>
</body>
</html>
You can use this CDN-
https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.1.60/inputmask/jquery.inputmask.js
A working demo is given here for you-
$("#piash").inputmask("A-999");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.1.60/inputmask/jquery.inputmask.js"></script>
<td>
<input value="A-45" id="piash">
</td>
While this question is old I believe I have found a solution for those with a similar problem. The noConflict() function fixed it.
<script type='text/javascript'>
$j=jQuery.noConflict();
$j(document).ready(function () {
$j("#currIN").inputmask("9999");
});
</script>
来源:https://stackoverflow.com/questions/28510610/jquery-inputmask-not-working