简体   繁体   English

digitalBush jQuery Mask无法与asp.net mvc3 IE9一起使用

[英]digitalBush jQuery Mask not working with asp.net mvc3 IE9

I am trying to add a SIN # mask of 999-999-999 on an input box which has other validation specified in the controller. 我试图在输入框上添加SIN#掩码999-999-999,该输入框具有在控制器中指定的其他验证。 However, for some reason it's not firing - when I load the page and click in the textbox, nothing happens other than the standard blinking cursor with no mask showing. 但是,由于某种原因,它无法触发-当我加载页面并在文本框中单击时,除了标准的闪烁光标且未显示任何遮罩之外,没有任何反应。 I'm testing in IE 9.0.112. 我正在IE 9.0.112中进行测试。

I've added the scripts as well as the script on the Site.Master page after downloading the plugin from DigitalBush. 从DigitalBush下载插件后,我已经在Site.Master页面上添加了脚本和脚本。

<script type = "text/javascript" src="/Scripts/jquery-1.8.3.min.js" />
<script type = "text/javascript" src="/Scripts/jquery.maskedinput-1.3.js" />

<script type = "text/javascript">
$(document).ready(function () {   
$("#Sin").mask("999-999-999");
});
</script>

On my PersonCreate page which is loaded in the content area of the Site.Master page, I have an HTML helper textbox defined: 在加载到Site.Master页面内容区域中的PersonCreate页面上,我定义了一个HTML帮助器文本框:

<%=Html.TextBoxFor(c => Model.Sin, new {maxlength=11})

I looked at the source after I ran the app and it's rendered as <input name="Sin" id="Sin" type="text" maxLength="11" value=""/> 运行应用程序后,我查看了源代码,并将其呈现为<input name =“ Sin” id =“ Sin” type =“ text” maxLength =“ 11” value =“” />

The scripts are located in MySolutionName/Scripts/ folder. 脚本位于MySolutionName / Scripts /文件夹中。 I've tried the following: 我尝试了以下方法:

Could someone please tell me what I might be missing? 有人可以告诉我我可能会想念什么吗? Thanks so much in advance. 非常感谢。

Turns out that for some reason, when I typed in the name/path for the javascript files, I didn't have the right path specified. 事实证明,由于某种原因,当我输入javascript文件的名称/路径时,没有指定正确的路径。 The best way to get around this problem is to simply drag and drop the file from the Solution Explorer directly into the Site.Master file, where all the scripts are being specified. 解决此问题的最佳方法是简单地将文件从解决方案资源管理器中直接拖放到指定所有脚本的Site.Master文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM