I'm like to use this function to replace accented characters on form
function remove_accents(text)
{
//text = text.toLowerCase();
text = text.replace(new RegExp('[ÁÀÂÃ]','gi'), 'a');
text = text.replace(new RegExp('[ÉÈÊ]','gi'), 'e');
text = text.replace(new RegExp('[ÍÌÎ]','gi'), 'i');
text = text.replace(new RegExp('[ÓÒÔÕ]','gi'), 'o');
text = text.replace(new RegExp('[ÚÙÛ]','gi'), 'u');
text = text.replace(new RegExp('[Ç]','gi'), 'c');
return text;
}
If i call an alert, all work as expected
alert (remove_accents('ãéíóú')); // ok
Now, I need to apply this to all INPUT fields on a form, to replace specialcharacters with normal and I'm trying in this way, but with NO success.
$(document).ready(function(){
$(":input" ).blur(function() {
// alert ('working!');
remove_accents();
});
});
What's wrong? Any help apprecited.