HTML CODE
<div id="border"> <textarea id='text'></textarea> </div> <button id="count">Count</button> <div id="result"> Words: <span id="wordCount">0</span><br/> Total Characters(including trails): <span id="totalChars">0</span><br/> Characters (excluding trails): <span id="charCount">0</span><br/> Characters (excluding all spaces): <span id="charCountNoSpace">0</span> </div>
JAVASCRIPT CODE
counter = function() { var value = $('#text').val(); if (value.length == 0) { $('#wordCount').html(0); $('#totalChars').html(0); $('#charCount').html(0); $('#charCountNoSpace').html(0); return; } var regex = /\s+/gi; var wordCount = value.trim().replace(regex, ' ').split(' ').length; var totalChars = value.length; var charCount = value.trim().length; var charCountNoSpace = value.replace(regex, '').length; $('#wordCount').html(wordCount); $('#totalChars').html(totalChars); $('#charCount').html(charCount); $('#charCountNoSpace').html(charCountNoSpace); }; $(document).ready(function() { $('#count').click(counter); $('#text').change(counter); $('#text').keydown(counter); $('#text').keypress(counter); $('#text').keyup(counter); $('#text').blur(counter); $('#text').focus(counter); });
DEMO
Check this link http://jsfiddle.net/vetri/szfgmekm/1/
StarAndDaisy Diaper Bag/Maternity Bags for Mothers/Mom with Multi Compartments, Insulated Bottle Pockets, Waterproof, 30L capacity - Black Grey
₹1,449.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Jr. Sr. Baby Diaper Pants with Advanced Leak Protection | Soft & Comfortable| Medium | 7-12 Kg | 72 Counts | Pack of 1
₹499.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Johnson's Milk + Rice Cream, with Milk extracts and Vitamin E to Replenish Moisture, pH Balanced, 200gm, White
₹210.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Silicon Edge Protector, 3-Meter with 4 Coners Baby Proofing Edge Protector Strip for Kids Table Corner Protector for Sharp Edges, Desk, Table, Bed, Safety Cover for Sharp Corners Edges (3 Meter)
₹349.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)TEDDYY Baby Easy Pant Diapers Medium 74 Count (Pack of 1), 7-12 kgs, 10 hrs Leak Protection, Anti - Bacterial
₹509.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Sebamed Baby Cleansing Bar 100 gm|pH 5.5 |Newborn bathing|Soap Free|Tear Free|
₹300.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)MamyPoko Pants Extra Absorb Baby Diapers, Large (L), 128 Count, 9-14 kg
₹1,608.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Himalaya Extra Moisturizing Baby Wash 400ml | No tears formula |with Olive Oil, Aloe Vera & Milk | Cleanses and moisturizes baby’s skin
₹198.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Little Rituals Mineral Baby & Kids SUNSCREEN Lotion Daily Use for Baby & Kids (0-15 years), SPF 40 PA+++ I No White Cast I UVA/UVB/IR + DIGITAL Wi-Fi & Bluelight Protection| Hypoallergenic| SWISS Technology | 75 gm
₹675.00 (as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)GITGRNTH Rechargeable Silicone Cat Night Light for Kids | Kawaii Cat Lamp Tap and Touch Color-Changing LED Changing Lamp |Adorable Room Decor & Gift for Toddlers, Teens (Cat Light Lamp, Regular)
Now retrieving the price.
(as of April 20, 2025 06:34 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)