Skip to content

Commit 1af1cae

Browse files
authored
advanced
1 parent 97d79e3 commit 1af1cae

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
document.addEventListener('DOMContentLoaded', function () {
2+
document.querySelector('HEADER').style.color = '#FF0000';
3+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$('document').ready(function () {
2+
$('DIV#add_item').click(function () {
3+
$('UL.my_list').append('<li>Item</li>');
4+
});
5+
$('DIV#remove_item').click(function () {
6+
$('UL.my_list li:last').remove();
7+
});
8+
$('DIV#clear_list').click(function () {
9+
$('UL.my_list').empty();
10+
});
11+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$('document').ready(function () {
2+
const url = 'https://www.fourtonfish.com/hellosalut/?';
3+
$('INPUT#btn_translate').click(function () {
4+
$.get(url + $.param({ lang: $('INPUT#language_code').val() }), function (data) {
5+
$('DIV#hello').html(data.hello);
6+
});
7+
});
8+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$('document').ready(function () {
2+
$('INPUT#btn_translate').click(translate);
3+
$('INPUT#language_code').focus(function () {
4+
$(this).keydown(function (e) {
5+
if (e.keyCode === 13) {
6+
translate();
7+
}
8+
});
9+
});
10+
});
11+
12+
function translate () {
13+
const url = 'https://www.fourtonfish.com/hellosalut/?';
14+
$.get(url + $.param({ lang: $('INPUT#language_code').val() }), function (data) {
15+
$('DIV#hello').html(data.hello);
16+
});
17+
}

0 commit comments

Comments
 (0)