-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparrot.html
38 lines (30 loc) · 893 Bytes
/
parrot.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<html>
<head>
<title>Awesome jQuery Game!</title>
<script src="../jquery.js"></script>
<script>
// Functions can be assigned to variables!
var start = function() {
// Select the element with id="btn"
var btn = $('#btn');
// Select the element with id="userinput"
var input = $('#userinput');
// Pass a function to do when the button is clicked
btn.click(function() {
// Get the current value of the input textbox
var txt = input.val();
// Pop up the text to the user
alert(txt);
});
};
// Functions can be passed as arguments
// This ensures that the HTML is loaded
// before your JS runs
$(document).ready(start);
</script>
</head>
<body>
<input id="userinput" type="text">
<button id="btn" style="position:absolute;top:50px;">Click here</button>
</body>
</html>