0
I’d like to do something like:
For every word the user types, it looks like the image above.
The closest I could get was to know the amount of words he typed, follow code below:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div class="row">
<div class="input-field col s12">
<input id="first_name" type="text" class="validate palavras-chaves">
<label for="first_name">Palavras Chaves</label>
</div>
</div>
<script type="text/javascript">
var palavrasChaves = $(".palavras-chaves");
palavrasChaves.on("input",function(){
var conteudo = palavrasChaves.val();
var qntdPalavras = conteudo.split(/\S+/).length -1;
console.log(qntdPalavras);
});
</script>
How you are using Jquery, there are several plugins with this feature. You want something ready or implement "from scratch"?
– Renan Gomes
@Renan It would be interesting to implement from scratch, but could tell me which plugins?
– user129815
@Amanda take a look at the link that Renan passed, has several good options
– aa_sp
I tried to use Taggingjs and even worked in the browser, but the ideal would be to separate by space, because on mobile only applies the formatting when I leave the input. I wonder if I could change?
– user129815