File tree 1 file changed +27
-0
lines changed
user-input-with-forms/studio 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 6
6
// TODO: create a handler
7
7
window . addEventListener ( "load" , function ( ) {
8
8
// TODO: register the handler
9
+ let searchForm = document . getElementById ( "searchForm" ) ;
10
+ let goog
11
+ searchForm . addEventListener ( "submit" , function ( ) {
12
+ if ( searchForm . value === "google" ) {
13
+ searchForm . action = "https://www.google.com/search?" ;
14
+ } ;
15
+
16
+ } ) ;
17
+
9
18
} ) ;
10
19
</ script >
11
20
</ head >
14
23
15
24
< form id ="searchForm ">
16
25
<!-- TODO: add form elements -->
26
+ < input type ="text " name ="q ">
27
+ < label >
28
+ < input type ="radio " name ="engine " value ="google ">
29
+ Google
30
+ </ label >
31
+ < label >
32
+ < input type ="radio " name ="engine " value ="duckduckgo ">
33
+ DuckDuckGo
34
+ </ label >
35
+ < label >
36
+ < input type ="radio " name ="engine " value ="bing ">
37
+ Bing
38
+ </ label >
39
+ < label >
40
+ < input type ="radio " name ="engine " value ="ask ">
41
+ Ask
42
+ </ label >
43
+ < button > Go!</ button >
17
44
</ form >
18
45
19
46
</ body >
You can’t perform that action at this time.
0 commit comments