Count Display number of characters jQuery script PHP code textbox

PHP, Tutorial , 0 Comments

Count Display number of characters jQuery script PHP code textbox jQuery script to count the number of characters in a textbox JavaScript count characters in input textarea remaining character count javascript jquery count characters in input textarea character count javascript how to count characters in jquery JavaScript character count jquery character limit textarea character limit jquery


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(function () {
//lets use the jQuery Keyboard Event to catch the text typed in the textbox
$('#txtbox').keyup(function () {
//.val() will give the text from the textbox and .length will give the number of characters
var txtlen = $(this).val().length;
//.replace used here to replace the space in the string and .length is to count the characters
var txtlennospace = $(this).val().replace(/\s+/g, '').length;
//the below lines will display the results
$('#txtbox_count').text(txtlen);
$('#txtbox_count_no_space').text(txtlennospace);

});
});
</script>

Enter your text: <input style="padding: 7px;" maxlength="60" size="50" type="text" id="txtbox" />
<p>No. of characters with space : <span id="txtbox_count"></span></p>
<p>No. of characters without space : <span id="txtbox_count_no_space"></span></p>

JavaScript count characters in input textarea remaining character count javascript jquery count characters in input textarea character count javascript how to count characters in jquery JavaScript character count jquery character limit textarea character limit jquery