Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC jQuery
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>
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();
            }
        });
    });
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 20:56pm
Edited 30-Apr-13 21:11pm
v2
Comments
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 Kornfeld Eliyahu Peter 275
1 Maciej Los 214
2 Sergey Alexandrovich Kryukov 200
3 King Fisher 185
4 OriginalGriff 163
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 1 May 2013
Copyright © CodeProject, 1999-2014
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