0
I have an input and would like to click Search or enter to open a certain address by adding the input value: Example
<form align="center" method="GET">
<input type="text" placeholder="Faça sua pergunta" autofocus name="query" size="50">
<input type="submit" onclick="myFunction()" value="Buscar">
</form>
<script>
function myFunction() {
var query = document.getElementsByName('query');
window.open("http://leituracrista.com/indice/?query=" + query.value);
}
</script>
Sylviot does not serve, because this way every search opens a new window, what I want is to be able to share this form so that it can be inserted in any site you want, without the need to share the whole html file, but only the search button, understand? but anyway thanks for the reply
– Miguel Silva
Does it solve?
var query = document.getElementsByName('query')[0];
window.open("http://leituracrista.com/indice/?query=" + query.value);
– SylvioT
testing and I’ll get back to you
– Miguel Silva
Perfect, thank you!
– Miguel Silva