JSFiddle - React, Tailwind, and code Playground

by Torwan

HTML

<input id="test" /> <input id="btn" type="button" value="Click for a count" />

JavaScript

$(document).ready(function () 
        {
        $("#btn").click(function()
                        {         
                            alert("All characters : " + $("#test").val().length  + 
                                  ", Characters only : " + $("#test").val().replace(/ /g,'').length +
                                  ", Trim() method : " + $.trim($("#test").val()).length);
                             
                        });
       
        });