File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed
0x15-javascript-web_jquery Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
2
+ document . querySelector ( 'HEADER' ) . style . color = '#FF0000' ;
3
+ } ) ;
Original file line number Diff line number Diff line change
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
+ } ) ;
Original file line number Diff line number Diff line change
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
+ } ) ;
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments