Jquery不适用于IE [英] Jquery does not work on IE

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

问题描述

我有一个文本框如下:

i have a textbox as follows:

<p>
@Html.Label("lblName", "Name")<br />
@Html.TextBox("txtName")
<n style="display: none; font-weight: bold;">Only alphabets allowed</n>
</p>



我按照以下方式将jquery应用于它:


and i have applied the jquery to it as follows:

$(document).ready(function () {
    $("#txtName").change(function () {
        var regex = /^[a-zA-Z]*$/;
        var Name= $("#txtName").val();
        if (!regex.test(Name)) {
            $('n').css('color', 'red');
            $('#txtName').css("border", "solid 1px red");
            $('n').show();
        }
        else {
            $('#txtName').css("border", "solid 1px #BBBBBB");
            $('n').hide();
        }
    });
});



上面的代码在Firefox和谷歌浏览器中运行得很好,但在IE浏览器中却没有...

有没有什么我必须添加才能解决这个问题???

请帮帮我


The above code works perfectly fine in Firefox and Google Chrome, but not in IE...
Is there anything that i must add to solve this issue???
Please help me

推荐答案

document )。ready( function (){
(document).ready(function () {


#txtName)。change( function (){
var regex = / ^ [a-zA-Z] *
("#txtName").change(function () { var regex = /^[a-zA-Z]*


/;
var 名称=


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

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