-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.html
More file actions
30 lines (26 loc) · 958 Bytes
/
task.html
File metadata and controls
30 lines (26 loc) · 958 Bytes
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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Hackers' Club JS Session</title>
</head>
<body>
<input id="first_name_text" placeholder="Enter first name"/>
<input id="last_name_text" placeholder="Enter last name" />
<button onclick="swap()"> Swap Names </button>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
function swap(){
/*var first = document.getElementById('first_name_text').value;
var last = document.getElementById('last_name_text').value;
document.getElementById('first_name_text').value = last;
document.getElementById('last_name_text').value = first;
*/
var first = $('#first_name_text').val();
var last = $('#last_name_text').val();
$('#first_name_text').val(last);
$('#last_name_text').val(first);
}
</script>
</html>