File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+
4+ < head >
5+ < script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js "> </ script >
6+ < script >
7+ $ ( document ) . ready ( function ( ) {
8+ $ ( "#btn1" ) . click ( function ( ) {
9+ $ ( "#test1" ) . text ( function ( i , originalText ) {
10+ return `Old text: ${ originalText } New text: Hello World! (index: ${ i } )` ;
11+ } ) ;
12+ } ) ;
13+
14+ $ ( "#btn2" ) . click ( function ( ) {
15+ $ ( "#test2" ) . html ( function ( i , originalText ) {
16+
17+ return `Old html: ${ originalText } New html: Hello <b> World! </b> (index: ${ i } )`
18+ } ) ;
19+ } ) ;
20+
21+ $ ( "#btn3" ) . click ( function ( ) {
22+ $ ( "#test3" ) . val ( "Hello World!" ) ;
23+ } ) ;
24+
25+ $ ( "#btn4" ) . click ( function ( ) {
26+ $ ( "#hreftag" ) . attr ( {
27+ "href" : "https://github.com/"
28+ } ) ;
29+ $ ( "#linktag" ) . children ( "a" ) . text ( "github.com" ) ;
30+ } ) ;
31+ } ) ;
32+ </ script >
33+ </ head >
34+
35+ < body >
36+
37+ < p id ="test1 "> This is a < b > bold</ b > paragraph.</ p >
38+ < p id ="test2 "> This is another < b > bold</ b > paragraph.</ p >
39+
40+ < p > Input field: < input type ="text " id ="test3 " value ="Mickey Mouse "> </ p >
41+
42+
43+ < p id ="linktag "> < a id ="hreftag " href ="https://www.google.com/ " target ="blank "> google.com</ a > </ p >
44+
45+
46+ < button id ="btn1 "> Show Old/New Text</ button >
47+ < button id ="btn2 "> Show Old/New HTML</ button >
48+ < button id ="btn3 "> Set Value</ button >
49+ < button id ="btn4 "> Change href and title</ button >
50+
51+ </ body >
52+
53+ </ html >
You can’t perform that action at this time.
0 commit comments