Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Fill text area with lines (one character at one line) until browser allows. When you finish, leave text area, and js code will calculate characters too.

For my case I could enter only 7 characters (including white spaces) before chrome stopped me. Although value of max length attribute is 10.
Please suggest any solution for it. Is there any browser setting?

Thanks.
Posted
Comments
jaket-cp 12-Feb-15 6:20am    
Can you supply your code and sample data.
Click on the "Improve question", mouseover the question and it should display at bottom left of question.

1 solution

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>

$(document).ready(function(){
    $("input").keyup(function(){
    var j = $("input").val();
    if(j.length > 7)
    {
       var res = j.substring(0, 7);
        $("input").val(res);
     }
    });
});
</script>
</head>
<body>

Enter your name: <input type="text">

</input></body>
</html>
 
Share this answer
 

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