Why does the JS cose doesn't work ? What is the purpose of assining the value 'q' to name attribute of input type text ?


9/27/2019 2:48:31 PM

Abhay Rao

2 Answers

New Answer


the javascript is working, but the problem is input submit has their own event/routine. which is submitting the form. you usually can prevent this from firing (but please note, that means you need to submit the form yourself using javascript) by calling preventdefault ( https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault ) on their event object, not every event can be canceled by this though. next, is whats the purpose of name q. it'll be use as a parameter that sent to the server. in this case q will be sent to google with value of the input text.


Can you please make some required changes in my code?