Click here to Skip to main content
11,640,788 members (69,036 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: MVC jQuery
i have a textbox as follows:
@Html.Label("lblName", "Name")<br />
<n style="display: none; font-weight: bold;">Only alphabets allowed</n>
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");
            else {
                $('#txtName').css("border", "solid 1px #BBBBBB");
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 30-Apr-13 19:56pm
Edited 30-Apr-13 20:11pm
Brian A Stephens at 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 at 2-May-13 11:06am
IE 8 abd below do not support custom tags. For IE 8 & belwo change the tag to <span>

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

  Print Answers RSS
0 Mika Wendelius 380
1 OriginalGriff 205
2 DamithSL 203
3 Afzaal Ahmad Zeeshan 129
4 CPallini 125
0 Mika Wendelius 380
1 OriginalGriff 205
2 DamithSL 203
3 CPallini 125
4 Afzaal Ahmad Zeeshan 89

Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 1 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100