Write a jQuery code to allow the user to enter only 15 characters into the textbox.

 Write a jQuery code to allow the user to enter only 15 characters into the textbox.

Write a jQuery code to allow the user to enter only 15 characters into the textbox.

Answer :
File Name : jQuery.html

<html>
<head>
   <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
    <title>SP Creation</title>
</head>
<body>
<div id="box">
    <h2>jquery</h2>
</div>
    <div class="container">
        <form class="form-group">
            <div class="col">
                <textarea id="char" cols="50" rows="5"></textarea>
            </div>
        </form>
    </div>
    <script>
       $(document).ready(function(){
            $('#char').keydown(function(){
                var clen = $("#char").val().length;
               if(clen>15){
                this.disabled = true;
               }
            });
       });
    </script>
</body>
</html>
Write a jQuery code to allow the user to enter only 15 characters into the textbox. Write a jQuery code to allow the user to enter only 15 characters into the textbox. Reviewed by technical_saurabh on May 02, 2021 Rating: 5

No comments:

Powered by Blogger.