Skip to content

Commit cdfb39c

Browse files
committed
studio
1 parent 8b4b8b7 commit cdfb39c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

user-input-with-forms/studio/index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,26 @@
33
<head>
44
<meta charset="utf-8">
55
<script>
6+
let action = {
7+
"google": "https://www.google.com/search",
8+
"duckDuckGo": "https://duckduckgo.com/",
9+
"bing": "https://www.bing.com/search",
10+
"ask": "https://www.ask.com/web"
11+
12+
}
13+
function setSearchEngine (){
14+
const form = document.querySelector('form');
15+
const query = document.getElementById('q');
16+
17+
18+
}
19+
620
// TODO: create a handler
721
window.addEventListener("load", function(){
822
// TODO: register the handler
23+
24+
const form = document.querySelector("form");
25+
form.addEventListener("submit", setSearchEngine());
926
});
1027
</script>
1128
</head>
@@ -14,6 +31,12 @@
1431

1532
<form id="searchForm">
1633
<!-- TODO: add form elements -->
34+
<label><input type="text" name="q"></label>
35+
<label><input type="radio" name="engine" value="google">Google</label>
36+
<label><input type="radio" name="engine" value="duckDuckGo">DuckDuckGo</label>
37+
<label><input type="radio" name="engine" value="bing">Bing</label>
38+
<label><input type="radio" name="engine" value="ask">Ask</label>
39+
<label><input type="button" name="submit" value="Go!"></label>
1740
</form>
1841

1942
</body>

0 commit comments

Comments
 (0)