Answer the question
In order to leave comments, you need to log in
Is it possible to transliterate the entered string in the form?
I have a form
<form action="/ru/search/node/" method="get" id="searchform">
<span class="icon"><i class="fa fa-search"></i></span>
<input type="search" id="search" placeholder="Поиск..." />
<input type="submit">
</form>
document.getElementById('search').addEventListener('input',function(){
var form=document.getElementById('searchform');
form.action=form.action.replace(/(\/search\/node\/).+/,'$1')+this.value;
console.log(form.action);
});
Answer the question
In order to leave comments, you need to log in
function translit(value){
return 'translit = ' + value; // здесь происходит транслит
}
document.getElementById('search').addEventListener('input',function(){
var form=document.getElementById('searchform');
form.action=form.action.replace(/(\/search\/node\/).+/,'$1')+ translit(this.value);
console.log(form.action);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question