Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a textbox as follows:
C#
<p>
@Html.Label("lblName", "Name")<br />
@Html.TextBox("txtName")
<n style="display: none; font-weight: bold;">Only alphabets allowed</n>
</p>

and i have applied the jquery to it as follows:
JavaScript
$(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();
        }
    });
});

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
Posted
Updated 30-Apr-13 20:11pm
v2
Comments
Brian A Stephens 1-May-13 8:41am    
I tried this code in IE, and it works. Can you post the code to jsFiddle, as it was rendered by MVC? I didn't use MVC; I entered the <label> and <input> tags manually. Also, what version of IE were you trying?
Prasad Khandekar 2-May-13 11:06am    
IE 8 abd below do not support custom tags. For IE 8 & belwo change the <n> tag to <span>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900