Why does the JS cose doesn't work ? What is the purpose of assining the value 'q' to name attribute of input type text ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

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

https://code.sololearn.com/WEEp3AqJLtbv/?ref=app

27th Sep 2019, 2:48 PM
Abhay Rao
Abhay Rao - avatar
2 Answers
+ 2
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.
27th Sep 2019, 3:30 PM
Taste
Taste - avatar
+ 1
Can you please make some required changes in my code?
27th Sep 2019, 5:23 PM
Abhay Rao
Abhay Rao - avatar