jQuery.inputmask不起作用 [英] Jquery.inputmask not working

查看:482
本文介绍了jQuery.inputmask不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图使用Robin Herbots Inputmask模块,但无法使其正常工作.查看所有其他类似的帖子,这是确保docment.ready函数具有对inputmask()的调用的常见问题,但这对我来说很好.

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.

脚本

<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

mainReady-client.js

$(document).ready(function() {
  $(":input").inputmask();
});

HTML

<td>
  <input value="10" data-inputmask="'mask': '999'">
</td>

我尝试过:

$(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'");
});

然后:

<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.

推荐答案

尝试使用此inputmask脚本,

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>

工作示例JSFIDDLE

Working example JSFIDDLE

<!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>

这篇关于jQuery.inputmask不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆