How to Count the Number of Characters Without Spaces in Browser Using jQuery in Javascript Full Project For Beginners

 

 

 

Welcome folks today in this blog post we will be counting the number of characters without spaces in browser using jquery in javascript.All the full source code of the application is shown below.

 

 

 

Get Started

 

 

 

In order to get started you need to make an index.html file and copy paste the following code

 

 

index.html

 

 

<html>
     <head>
          <title> Your Title here</title>
     </head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script> 
$(function () { 
$('#txtbox').keyup(function () { 
var count = $(this).val().replace(/\s+/g, '').length; 
$('#count_result').text(count); 
}); 
}); 
</script>
<body>
<div>
<input style="padding: 7px;" maxlength="60" size="50" type="text" id="txtbox" />

            <p>No. of characters without spaces is <span id="count_result"></span></p>
        </div>
</body>
</html>

Leave a Reply