Reputation: 15
is there any way i can submit a form without creating submit button, but using only type="text"? whenever i type every variable in the text area it submits.
I'm trying to create a live search using html and php mysql.
Upvotes: 0
Views: 69
Reputation: 988
If you're doing a live search you're going to need to investigate AJAX (aka XHR). Submitting a form every time somebody changes the value of a textbox is a really bad way of doing it.
However if you really wanted to then you're going to have to attach an event listener to the textbox, listening for a keypress or keyup event.
What (if any) Framework are you using.
Upvotes: 0
Reputation: 2361
use onBlur
event on textarea
element and submit your form using java script like this
<form id="testform">
<textarea onblur="submitForm()"></textare>
</form>
<script>
function submitForm(){
document.getElementById("testform").submit();
}
</script>
Upvotes: 1