Search
 
SCRIPT & CODE EXAMPLE
 

HTML

word count alpine js

<div x-data="{ wordCount: 0 }" x-init="wordCount = $el.querySelector('textarea').value.trim().split(' ').length;">
  
  <textarea class="form-input border" rows=5 @keyup="wordCount = $event.target.value.trim().split(' ').length;"></textarea>
       
  <p class="text-xs" :class="wordCount < 20 ? 'text-red-700' : 'text-green-700'">Word counts: <span x-html="wordCount"></span> min: 20</p>
</div>
Comment

PREVIOUS NEXT
Code Example
Html :: change the size of canvas char.js 
Html :: How can React read a session SET in PHP 
Html :: service run on start 
Html :: submit form include input type submit 
Html :: http request for resource not found 
Html :: html form meta data for image encryption 
Html :: html drag and drag prograssive bar 
Html :: file type input limit in html 
Html :: bootstrap hide show toggle collapse 
Html :: learn html 
Html :: html project ideas 
Html :: animate html 
Html :: html index page 
Html :: HTML <small Element 
Css :: disable drag image css 
Css :: css media queries 
Css :: input checkbox size 
Css :: position absolute center horizontally 
Css :: css text auto break line 
Css :: css text no word wrap 
Css :: how to center a div in css 
Css :: html make footer stick to bottom 
Css :: reset css cdn 
Css :: place item center in css using grid 
Css :: border: 1px solid black; 
Css :: tint png white css 
Css :: downgrade composer to 1 in vagrant 
Css :: how to make img cover parent div 
Css :: slide up and down animation css 
Css :: scss sass watch command line 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =