VISUALLY INDICATE TO THE USER WHEN THE TEXTBOX LIMIT HAS BEEN EXCEEDED

Mark Devid

Total Post:102

Points:714
Posted by  Mark Devid
C# 
 880  View(s)
Ratings:
Rate this:

I am new asp.net now I need to visually indicate to the user when the textbox limit exceeded. Please give a solution.

 

<asp:TextBox ID="Txtbox" runat="server" Height="50px" TextMode="MultiLine"

        Width="150px" MaxLength="50"></asp:TextBox>

  1. Kamlakar Singh

    Post:194

    Points:1396
    Re: Visually indicate to the user when the textbox limit has been exceeded

    Try this

     

    $("#Txtbox").on('input',function () {

        if($(this).val().length == $(this).attr('maxlength')) {

            $(this).css('background-color','red');

        }

    });

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!