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/
Graysee Baby Cloth Diapers 0 To 3 Years | Side Leakage Proof Washable Reusable Diaper For New Born Baby | Freesize | Adjustable | Reduces Rash | With Quick Dry Pad/Insert (Only 3 Diaper,Not Insert Include)
₹349.00 (as of November 21, 2024 11:50 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.)3 in 1 Baby Bed, Sleeping Bag & Carry Nest, Cotton Baby Bedding for New Born & Infant, Portable Bassinet, for Baby Carrying & Unisex Baby Sleeping Bed (Cream)
₹310.00 (as of November 21, 2024 11:50 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.)SNOWIE SOFT® 4Pcs Baby Booger Cleaning Tools Dual Head Baby Nasal Booger Pick Up Tool Color Cartoon Soft Silicone Booger Picker for Newborns
₹499.00 (as of November 21, 2024 11:50 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.)Fluffybliss Silicone Corner Protector Sharp Edge Protector for Furniture Like Baby Bed Table Corners Edge Protector Child Safety Corner Edge Corner Safety Guard for Kids (Transparent, 8pcs)
₹236.00 (as of November 21, 2024 11:50 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.)Mother Sparsh 99% Pure Water (Unscented) Baby Wipes I Natural Plant made cloth - Super thick Wet Wipes I 72 pcs/pack - Pack of 2 (Super Saver Pack)
₹399.00 (as of November 21, 2024 11:50 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 Total Care Baby Pants Diapers, Large 76 Count, Anti-Rash Shield, 9-14 kg, Rapid Absorption, Superior Comfort, Clinically tested
₹1,049.00 (as of November 21, 2024 11:50 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.)Promom Wearable Electric Breast Pump for Feeding Mothers, Automatic Hands-Free Pumping Machine with 3 Modes & 8 Suction Levels, Portable & Cordless with USB Charging, FDA Approved, Patented Diaphragm Case Technology, Best-In Class Suction-450MmHg/60KPA, Smart LED Display, 160ml BPA-Free Milk Cup, Quiet & Compact (1 Year Warranty) - Pack of 1
Now retrieving the price.
(as of November 21, 2024 11:50 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.)