Click here to Skip to main content
11,920,211 members (46,125 online)
Rate this:
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 20:56pm
Edited 30-Apr-13 21:11pm
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 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 OriginalGriff 455
1 phil.o 170
2 CPallini 150
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,153
3 George Jonsson 2,810
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web02 | 2.8.151120.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