I have < input type="text" id="A" >
, I would like that when entering any text in this input, it was rewritten in input B, but before the text is rewritten, I would like it to be "cleaned". This cleanup is to remove special characters from the text, and to replace "spaces" with "-".
I already do this "cleanup" with php, but it's not something dynamic. So the clean text is not always the way I want it! Example of this is the following situation!
Before:
"Esse é um TEXTO que ééu quero LIMpar! Verá ele limpo em Seguida!"
Then
"esse-e-um-texto-que-eeu-quero-limpar--vera-ele-limpo-em-seguida-"
Now with this rewrite of the text I will be able to control the final result better! So if I do not like it I'll be able to edit the final text before it even registers in the database.
The php code I use to clear this text is:
$ltag = strtolower(preg_replace('{\W}', ' ', preg_replace('{ +}', ' ', strtr(utf8_decode(html_entity_decode($tag)), utf8_decode('ÀÁÃÂÉÊÍÓÕÔÚÜÇÑàáãâéêíóõôúüçñ'), 'AAAAEEIOOOUUCNaaaaeeiooouucn'))));