Write a jQuery code to Restrict "number"-only input for textboxes including decimal points.

 Write a jQuery code to Restrict "number"-only input for textboxes including decimal points.

Write a jQuery code to Restrict "number"-only input for textboxes including decimal points. 

Answer : 
File Name : 

<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 class="container">
        <div class="col">
            <h2>jQuery</h2>
        </div>
        <div class="col">
            <label for="no">Enter Number : </label>
            <input type="text" id="no" value="">
        </div>
    </div>
    <script>
        $(document).ready(function(){
           $("#no").keyup(function(){
            this.value = this.value.replace(/[^0-9\.]/g,'');
           });
        });
    </script>
</body>
</html>
Write a jQuery code to Restrict "number"-only input for textboxes including decimal points. Write a jQuery code to Restrict "number"-only input for textboxes including decimal points. Reviewed by technical_saurabh on May 03, 2021 Rating: 5

No comments:

Powered by Blogger.