-
Notifications
You must be signed in to change notification settings - Fork 34
/
basic-html-and-html5.json
1478 lines (1478 loc) · 79.9 KB
/
basic-html-and-html5.json
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"name": "Basic HTML and HTML5",
"order": 0,
"time": "5 hours",
"helpRoom": "Help",
"challenges": [
{
"id": "bd7123c8c441eddfaeb5bdef",
"title": "Say Hello to HTML Elements",
"description": [
"欢迎来到 freeCodeCamp 的 HTML 编码挑战,这些挑战将会帮助你逐步掌握 Web 开发。",
"HTML 是英文 Hyper Text Markup Language(超文本标记语言)的缩写。首先,使用 HTML 来制作一个简单的网页,你可以直接在本网页内置的代码编辑器中编辑代码。",
"你看到代码编辑器中的 <code><h1>Hello</h1></code> 了吗? 那就是一个 HTML 标签。",
"大部分 HTML 标签都有一个 <code>开始标记</code> 和一个 <code>结束标记</code>。",
"开始标记像这样:<code><h1></code>",
"结束标记像这样:<code></h1></code>",
"开始标记和结束标记的唯一区别就是结束标记多了一个 <code>/</code>。",
"每个挑战都有测试,任何时候点击<strong>运行测试</strong>按钮就可以运行测试。如果代码通过测试,将会弹出一个窗口,你就可以提交你的代码并顺利进入下一个挑战。",
"<hr>",
"请把 <code>h1</code> 标签的内容改为:<code>Hello World</code>。"
],
"tests": [
{
"text": "<code>h1</code> 标签的内容应该为:<code>Hello World</code>。",
"testString": "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), '<code>h1</code> 标签的内容应该为:<code>Hello World</code>。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h1>Hello</h1>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf0887a",
"title": "Headline with the h2 Element",
"description": [
"在接下来的几节课里,我们将会由浅入深地制作一个关于猫的图片应用。",
"这节课将会引入 <code>h2</code> 标签。",
"这些标签用来告诉浏览器,网站的结构长什么样子。<code>h1</code> 标签通常被用作主标题,<code>h2</code> 标签通常被用作副标题,还有 <code>h3</code>、<code>h4</code>、<code>h5</code>、<code>h6</code> 标签,它们分别用作不同级别的标题。",
"<hr>",
"在 <code>h1</code> 标签下面创建一个 <code>h2</code> 标签,标签内容为:<code>CatPhotoApp</code>。"
],
"tests": [
{
"text": "创建一个 <code>h2</code> 标签。",
"testString": "assert(($(\"h2\").length > 0), '创建一个 <code>h2</code> 标签。');"
},
{
"text": "<code>h2</code> 标签应该有结束标记。",
"testString": "assert(code.match(/<\\/h2>/g) && code.match(/<\\/h2>/g).length === code.match(/<h2>/g).length, '<code>h2</code> 标签应该有结束标记。');"
},
{
"text": "<code>h2</code> 标签的内容应该为:<code>CatPhotoApp</code>。",
"testString": "assert.isTrue((/cat(\\s)?photo(\\s)?app/gi).test($(\"h2\").text()), '<code>h2</code> 标签的内容应该为:<code>CatPhotoApp</code>。');"
},
{
"text": "<code>h1</code> 标签的内容应该为:<code>Hello World</code>。",
"testString": "assert.isTrue((/hello(\\s)+world/gi).test($(\"h1\").text()), '主标题的内容应该为:<code>Hello World</code>。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h1>Hello World</h1>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08801",
"title": "Inform with the Paragraph Element",
"description": [
"<code>p</code> 是 <code>paragraph</code> 的缩写,通常被用来创建一个段落,就和你写作文一样。",
"你可以像这样创建一个段落:",
"<code><p>I'm a p tag!</p></code>",
"<hr>",
"在 <code>h2</code> 标签下面新增一个 <code>p</code> 标签,标签内容是:<code>Hello Paragraph</code>。"
],
"tests": [
{
"text": "创建一个 <code>p</code> 标签。",
"testString": "assert(($(\"p\").length > 0), '创建一个 <code>p</code> 标签。');"
},
{
"text": "<code>p</code> 标签的内容应该为:<code>Hello Paragraph</code>。",
"testString": "assert.isTrue((/hello(\\s)+paragraph/gi).test($(\"p\").text()), '<code>p</code> 标签的内容应该为:<code>Hello Paragraph</code>。');"
},
{
"text": "<code>p</code> 标签应该有结束标记。",
"testString": "assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, '<code>p</code> 标签应该有结束标记。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h1>Hello World</h1>",
"<h2>CatPhotoApp</h2>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08833",
"title": "Fill in the Blank with Placeholder Text",
"description": [
"Web 开发者通常用 <a href='http://www.ruanyifeng.com/blog/2009/04/lorem_ipsum.html'>lorem ipsum text</a> 来做占位符,占位符就是占着位置的一些文字,没有实际意义。",
"为什么叫 <code>lorem ipsum text</code> 呢?是因为 <code>lorem ipsum</code> 是古罗马西塞罗谚语的前两个单词。",
"从公元16世纪开始 <code>lorem ipsum text</code> 就被当做占位符了,这种传统延续到了互联网时代。于此同时,孙悟空也在五指山下被压了500年,然后就进化成程序猿了,是不是很巧合。^_^",
"<hr>",
"把 <code>p</code> 标签的内容更换为:<code>Monkey code 猴哥猴哥,你真了不得,金箍棒在手,问世间谁是英雄。</code>"
],
"tests": [
{
"text": "<code>p</code> 标签的内容必须包含 <code>Monkey code</code>。",
"testString": "assert.isTrue((/Monkey(\\s)+code/gi).test($(\"p\").text()), '<code>p</code> 标签的内容必须包含 <code>Monkey code</code>。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h1>Hello World</h1>",
"",
"<h2>CatPhotoApp</h2>",
"",
"<p>Hello Paragraph</p>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08802",
"title": "Uncomment HTML",
"description": [
"注释的作用是给代码添加一些说明,方便团队合作或日后自己查看,但又不影响代码本身。",
"注释也可以用来在不删除代码的前提下,让代码不起作用。",
"在 HTML 中,注释的开始标记是 <code><!--</code>,结束标记是 <code>--></code>。",
"<hr>",
"现在我们反其道而行之,干掉 <code>h1</code> 标签、<code>h2</code> 标签、<code>p</code> 标签的注释。"
],
"tests": [
{
"text": "确保网页中能看到 <code>h1</code> 标签。",
"testString": "assert($(\"h1\").length > 0, '确保网页中能看到 <code>h1</code> 标签。');"
},
{
"text": "确保网页中能看到 <code>h2</code> 标签。",
"testString": "assert($(\"h2\").length > 0, '确保网页中能看到 <code>h2</code> 标签。');"
},
{
"text": "确保网页中能看到 <code>p</code> 标签。",
"testString": "assert($(\"p\").length > 0, '确保网页中能看到 <code>p</code> 标签。');"
},
{
"text": "确保删除了注释的结束标记 <code>--></code>",
"testString": "assert(!/[^fc]-->/gi.test(code.replace(/ *<!--[^fc]*\\n/g,'')), '确保删除了注释的结束标记 <code>--></code>');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<!--",
"<h1>Hello World</h1>",
"",
"<h2>CatPhotoApp</h2>",
"",
"<p>Monkey code 猴哥猴哥,你真了不得,金箍棒在手,问世间谁是英雄。</p>",
"-->"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08804",
"title": "Comment out HTML",
"description": [
"记住:注释的开始标记是 <code><!--</code>,结束标记是 <code>--></code>。",
"现在你需要在 <code>h2</code> 标签前终止注释。",
"<hr>",
"任务:<code>h1</code> 标签和 <code>p</code> 标签都注释掉,<code>h2</code> 标签保留。"
],
"tests": [
{
"text": "注释掉 <code>h1</code> 标签,这样它就从网页上消失了。",
"testString": "assert(($(\"h1\").length === 0), '注释掉 <code>h1</code> 标签,这样它就从网页上消失了。');"
},
{
"text": "<code>h2</code> 标签保持原样,这样网页上还能看到它。",
"testString": "assert(($(\"h2\").length > 0), '<code>h2</code> 标签保持原样,这样网页上还能看到它。');"
},
{
"text": "注释掉 <code>p</code> 标签,这样它就从网页上消失了。",
"testString": "assert(($(\"p\").length === 0), '注释 <code>p</code> 标签,这样它就从网页上消失了。);"
},
{
"text": "确保每一个注释都以 <code>--></code> 结尾。",
"testString": "assert(code.match(/[^fc]-->/g).length > 1, '确保每一个注释都以<code>--></code>结尾。');"
},
{
"text": "不要更改 <code>h1</code> 标签、<code>h2</code> 标签、<code>p</code> 标签的顺序。",
"testString": "assert((code.match(/<([a-z0-9]){1,2}>/g)[0]===\"<h1>\" && code.match(/<([a-z0-9]){1,2}>/g)[1]===\"<h2>\" && code.match(/<([a-z0-9]){1,2}>/g)[2]===\"<p>\") , '不要更改 <code>h1</code> 标签、<code>h2</code> 标签、<code>p</code> 标签的顺序。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<!--",
"<h1>Hello World</h1>",
"",
"<h2>CatPhotoApp</h2>",
"",
"<p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
"-->"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fed1348bd9aedf08833",
"title": "Delete HTML Elements",
"description": [
"手机的屏幕空间是有限的。",
"让我们删除不必要的标签,开始设计我们的 CatPhotoApp。",
"<hr>",
"任务:删除 <code>h1</code> 标签以简化视图。"
],
"tests": [
{
"text": "删除 <code>h1</code> 标签。",
"testString": "assert(($(\"h1\").length == 0), '删除 <code>h1</code> 标签。');"
},
{
"text": "保留 <code>h2</code> 标签。",
"testString": "assert(($(\"h2\").length > 0), '保留 <code>h2</code> 标签。');"
},
{
"text": "保留 <code>p</code> 标签。",
"testString": "assert(($(\"p\").length > 0), '保留 <code>p</code> 标签。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h1>Hello World</h1>",
"",
"<h2>CatPhotoApp</h2>",
"",
"<p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aecf08801",
"title": "Introduction to HTML5 Elements",
"description": [
"HTML5 引入了很多更具描述性的 HTML 标签,例如:<code>header</code>、<code>footer</code>、<code>nav</code>、<code>video</code>、<code>article</code>、<code>section</code> 等等。",
"这些标签让 HTML 更易读,同时有助于搜索引擎优化和无障碍访问。",
"<code>main</code> 标签让搜索引擎和开发者瞬间就能找到网页的主要内容。",
"<strong>注意</strong><br>在后面的应用无障碍课程中我们会接触到更多新的 HTML5 标签,以及明白它们的用处。",
"<hr>",
"在现有的段落下创建一个新的段落,段落内容为:养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。",
"在第一个段落前添加 <code><main></code>,在第二个段落后添加 <code></main></code>。"
],
"tests": [
{
"text": "页面中应该有两个段落。",
"testString": "assert($(\"p\").length > 1, '页面中应该有两个段落。');"
},
{
"text": "确保每个段落都有结束标记。",
"testString": "assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, '确保每个段落都有结束标记。');"
},
{
"text": "新建的段落应该包含关键词:养猫。",
"testString": "assert.isTrue((/养猫/).test($(\"p\").text()), '新建的段落应该包含关键词:养猫。');"
},
{
"text": "代码中应该包含 <code>main</code> 标签。",
"testString": "assert($('main').length === 1, '代码中应该包含 <code>main</code> 标签。');"
},
{
"text": "<code>main</code> 标签应有两个 <code>p</code> 标签作为它的子标签。",
"testString": "assert($(\"main\").children(\"p\").length === 2, '<code>main</code> 标签应有两个 <code>p</code> 标签作为它的子标签。');"
},
{
"text": "开始标记 <code><main></code> 应位于第一个段落之前。",
"testString": "assert(code.match(/<main>\\s*?<p>/g), '开始标记 <code><main></code> 应位于第一个段落之前。');"
},
{
"text": "结束标记 <code></main></code> 应位于第二段落之后。",
"testString": "assert(code.match(/<\\/p>\\s*?<\\/main>/g), '结束标记 <code></main></code> 应位于第二个段落之后。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"",
"<p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08812",
"title": "Add Images to Your Website",
"description": [
"用 <code>img</code> 标签来为你的网站添加图片,其中 <code>src</code> 属性指向一个图片的地址。",
"举例如下:",
"<code><img src=\"https://www.your-image-source.com/your-image.jpg\"></code>",
"注意:<code>img</code> 标签是自关闭标签,不需要结束标记。",
"所有的 <code>img</code> 标签必须有 <code>alt</code> 属性,<code>alt</code> 属性的文本是当图片无法加载时显示的替代文本,这对于通过屏幕阅读器来浏览网页的用户非常重要。",
"注意:如果图片是纯装饰性的,用一个空的 <code>alt</code> 是最佳实践。",
"理想情况下,<code>alt</code>属性不应该包含特殊字符,除非需要。",
"让我们给上面例子的 <code>img</code> 添加 <code>alt</code> 属性。",
"<code><img src=\"https://www.your-image-source.com/your-image.jpg\" alt=\"作者站在沙滩上竖起两个大拇指\"></code>",
"<hr>",
"让我们给网站添加图片:",
"在 <code>h2</code> 标签前,插入一个 <code>img</code> 标签",
"现在设置 <code>src</code> 属性指向这个地址:",
"<code>https://bit.ly/fcc-relaxing-cat</code>",
"最后不要忘记给图片添加一个 <code>alt</code> 文本。"
],
"tests": [
{
"text": "网页应该有一张图片。",
"testString": "assert($(\"img\").length > 0, '网页应该有一张图片。');"
},
{
"text": "这张图片应该是一只小猫。",
"testString": "assert(new RegExp(\"\\/\\/bit.ly\\/fcc-relaxing-cat|\\/\\/s3.amazonaws.com\\/freecodecamp\\/relaxing-cat.jpg\", \"gi\").test($(\"img\").attr(\"src\")), '这张图片应该是一只小猫。');"
},
{
"text": "图片必须有 <code>alt</code> 属性。",
"testString": "assert(code.match(/alt\\s*?=\\s*?(\\\"|\\').*(\\\"|\\')/), '图片必须有 <code>alt</code> 属性。');"
}
],
"challengeType": 0,
"guideUrl": "https://guide.freecodecamp.org/certificates/add-images-to-your-website",
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" ",
" ",
" <p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
" <p>养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08816",
"title": "Link to External Pages with Anchor Elements",
"description": [
"你可以用锚点(Anchor,简写 a)来实现网页间的跳转。",
"锚点需要一个 <code>href</code> 属性指向目的地,它还需要有锚点文本,例如:",
"<code><a href=\"https://freecodecamp.org\">this links to freecodecamp.org</a></code>",
"然后你的浏览器会显示一个可以点击的文本,点击该文本就会跳转到 <strong>https://www.freecodecamp.org</strong>。",
"<hr>",
"创建一个 <code>a</code> 标签,<code>href</code> 属性为 <code>http://freecatphotoapp.com</code> ,锚点文本为:<code>cat photos</code>。"
],
"tests": [
{
"text": "<code>a</code> 标签的锚点文本应为:<code>cat photos</code>。",
"testString": "assert((/cat photos/gi).test($(\"a\").text()), '<code>a</code> 标签的锚点文本应为:<code>cat photos</code>。');"
},
{
"text": "<code>a</code> 标签的 <code>href</code> 属性应为:\"<code>http://freecatphotoapp<wbr>.com</code>\"。",
"testString": "assert(/http:\\/\\/(www\\.)?freecatphotoapp\\.com/gi.test($(\"a\").attr(\"href\")), '<code>a</code> 标签的 <code>href</code> 属性应为:\"<code>http://freecatphotoapp<wbr>.com</code>\"。');"
},
{
"text": "确保 <code>a</code> 标签有结束标记。",
"testString": "assert(code.match(/<\\/a>/g) && code.match(/<\\/a>/g).length === code.match(/<a/g).length, '确保 <code>a</code> 标签有结束标记。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" ",
" ",
" ",
" <img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\">",
" ",
" <p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
" <p>养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad88fee1348bd9aedf08816",
"title": "Link to Internal Sections of a Page with Anchor Elements",
"description": [
"锚点同样也可以用来在网页内不同区域的跳转。",
"用一个井号 <code>#</code> 加上你想跳转到的区域对应的 <code>id</code> 属性值,通过把它作为锚点的 <code>href</code> 属性值来创建一个内部链接。 <code>id</code> 是用来描述网页元素的一个属性,它的值在整个页面中唯一。",
"下面是用来创建内部锚点链接的例子:",
"<blockquote><a href=\"#contacts-header\">Contacts</a><br>...<br><h2 id=\"contacts-header\">Contacts</h2></blockquote>",
"当用户点击了 <code>Contacts</code> 链接,页面就会跳转到网页的 <b>Contacts</b> 区域。",
"<hr>",
"通过修改 <code>href</code> 属性为 <code>#footer</code> 来更改外部链接为内部链接,同时修改文本 <code>cat photos</code> 为 <code>Jump to Bottom</code>。",
"移除 <code>target=\"_blank\"</code> 属性避免点击链接会打开新的标签页。",
"然后添加一个 <code><footer></code> 标签,它的 <code>id</code> 值为 <code>footer</code>。"
],
"tests": [
{
"text": "页面中应该只有一个锚点。",
"testString": "assert($('a').length == 1, '页面中应该只有一个锚点。');"
},
{
"text": "页面中应该只有一个 <code>footer</code> 标签。",
"testString": "assert($('footer').length == 1, '页面中应该只有一个 <code>footer</code> 标签。');"
},
{
"text": "<code>a</code> 标签的 <code>href</code> 属性应为:\"#footer\"。",
"testString": "assert($('a').eq(0).attr('href') == \"#footer\", '<code>a</code> 标签的 <code>href</code> 属性应为:\"#footer\"。');"
},
{
"text": "<code>a</code> 标签不应该有 <code>target</code> 属性。",
"testString": "assert(typeof $('a').eq(0).attr('target') == typeof undefined || $('a').eq(0).attr('target') == true, '<code>a</code> 标签不应该有 <code>target</code> 属性。');"
},
{
"text": "<code>a</code> 标签的文本应为 <code>Jump to Bottom</code>。",
"testString": "assert($('a').eq(0).text().match(/Jump to Bottom/gi), '<code>a</code> 标签的文本应为 <code>Jump to Bottom</code>。');"
},
{
"text": "<code>footer</code> 标签的 <code>id</code> 属性应为 \"footer\"。",
"testString": "assert($('footer').eq(0).attr('id') == \"footer\", '<code>footer</code> 标签的 <code>id</code> 属性应为 \"footer\"。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" ",
" <a href=\"http://freecatphotoapp.com\" target=\"_blank\">cat photos</a>",
" ",
" <img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\">",
" ",
" <p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。 养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。 在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
" <p>养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。 在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。 养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>",
" ",
"</main>",
" ",
"<footer>Copyright Cat Photo App</footer>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aede08817",
"title": "Nest an Anchor Element within a Paragraph",
"description": [
"你可以在其他文本标签内嵌套链接。You can nest links within other text elements.",
"<blockquote><p><br> Here's a <a target=\"_blank\" href=\"http://freecodecamp.org\"> link to freecodecamp.org</a> for you to follow.<br></p></blockquote>",
"让我们来分解这个例子:",
"通常,文本是被包裹在 <code>p</code> 标签内:<br> <code><p> Here's a ... for you to follow. </p></code>",
"接下来是 <code>anchor</code> 标签 <code><a></code>(需要结束标记 <code></a></code>):<br> <code><a> ... </a></code>",
"<code>target</code> 是锚点标签的一个属性,它指定了会以什么方式来打开链接,属性值 <code>\"_blank\"</code> 的意思是链接会在新标签页打开。",
"<code>href</code> 是锚点标签的另一个属性:它指定了链接的 URL 地址:<br> <code><a href=\"http://freecodecamp.org\"> ... </a></code>",
"锚点标签内的文本:<strong>\"link to freecodecamp.org\"</strong>,会显示为一个可以点击的链接:<br> <code><a href=\" ... \">link to freecodecamp.org</a></code>",
"例子的最后输出将会是这样:<br><p>Here's a <a target=\"_blank\" href=\"http://freecodecamp.org\"> link to freecodecamp.org</a> for you to follow.</p>",
"<hr>",
"现在用一个新的 <code>p</code> 标签来包裹现存的 <code>a</code> 标签(必须放在 <code>main</code> 标签之后才行)。新段落的文本为:View more cat photos,其中 \"cat photos\" 是一个链接,其他是纯文本。"
],
"tests": [
{
"text": "你需要一个指向 \"http://freecatphotoapp.com\" 的锚点。",
"testString": "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").length > 0 || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").length > 0), '你需要一个指向 \"http://freecatphotoapp.com\" 的锚点。');"
},
{
"text": "锚点文本为应为:cat photos。",
"testString": "assert($(\"a\").text().match(/cat\\sphotos/gi), '锚点文本为应为:cat photos。');"
},
{
"text": "在锚点的外部创建一个新段落,这样页面就有3个段落了。",
"testString": "assert($(\"p\") && $(\"p\").length > 2, '在锚点的外部创建一个段落,这样页面就有3个段落了。');"
},
{
"text": "锚点应嵌套在新段落内。",
"testString": "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").parent().is(\"p\") || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().is(\"p\")), '锚点应嵌套在新段落内。');"
},
{
"text": "段落的文本应为:View more (记得 more 后面有一个空格)。",
"testString": "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").parent().text().match(/View\\smore\\s/gi) || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().text().match(/View\\smore\\s/gi)), '段落的文本应为:View more (记得 more 后面有一个空格)。');"
},
{
"text": "锚点的文本不应该为:View more。",
"testString": "assert(!$(\"a\").text().match(/View\\smore/gi), '锚点的文本不应该为:View more。');"
},
{
"text": "确保每个段落有结束标记。",
"testString": "assert(code.match(/<\\/p>/g) && code.match(/<p/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, '确保每个段落有结束标记。');"
},
{
"text": "确保每个段落有结束标记。",
"testString": "assert(code.match(/<\\/a>/g) && code.match(/<a/g) && code.match(/<\\/a>/g).length === code.match(/<a/g).length, '确保每个段落有结束标记。');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" ",
" <a href=\"http://freecatphotoapp.com\" target=\"_blank\">cat photos</a>",
" ",
" <img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\">",
" ",
" <p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
" <p>养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08817",
"title": "Make Dead Links Using the Hash Symbol",
"description": [
"Sometimes you want to add <code>a</code> elements to your website before you know where they will link.",
"This is also handy when you're changing the behavior of a link using <code>JavaScript</code>, which we'll learn about later.",
"<hr>",
"The current value of the <code>href</code> attribute is a link that points to \"http://freecatphotoapp.com\". Replace the <code>href</code> attribute value with a <code>#</code>, also known as a hash symbol, to create a dead link.",
"For example: <code>href=\"#\"</code>"
],
"tests": [
{
"text": "Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to \"#\".",
"testString": "assert($(\"a\").attr(\"href\") === \"#\", 'Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to \"#\".');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" <p>Click here to view more <a href=\"http://freecatphotoapp.com\" target=\"_blank\">cat photos</a>.</p>",
" ",
" <img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\">",
" ",
" <p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
" <p>养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08820",
"title": "Turn an Image into a Link",
"description": [
"You can make elements into links by nesting them within an <code>a</code> element.",
"Nest your image within an <code>a</code> element. Here's an example:",
"<code><a href=\"#\"><img src=\"https://bit.ly/fcc-running-cats\" alt=\"Three kittens running towards the camera.\"></a></code>",
"Remember to use <code>#</code> as your <code>a</code> element's <code>href</code> property in order to turn it into a dead link.",
"<hr>",
"Place the existing image element within an anchor element.",
"Once you've done this, hover over your image with your cursor. Your cursor's normal pointer should become the link clicking pointer. The photo is now a link."
],
"tests": [
{
"text": "Nest the existing <code>img</code> element within an <code>a</code> element.",
"testString": "assert($(\"a\").children(\"img\").length > 0, 'Nest the existing <code>img</code> element within an <code>a</code> element.');"
},
{
"text": "Your <code>a</code> element should be a dead link with a <code>href</code> attribute set to <code>#</code>.",
"testString": "assert(new RegExp(\"#\").test($(\"a\").children(\"img\").parent().attr(\"href\")), 'Your <code>a</code> element should be a dead link with a <code>href</code> attribute set to <code>#</code>.');"
},
{
"text": "Make sure each of your <code>a</code> elements has a closing tag.",
"testString": "assert(code.match(/<\\/a>/g) && code.match(/<a/g) && code.match(/<\\/a>/g).length === code.match(/<a/g).length, 'Make sure each of your <code>a</code> elements has a closing tag.');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" <p>Click here to view more <a href=\"#\">cat photos</a>.</p>",
" ",
" <img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\">",
" ",
" <p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
" <p>养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08827",
"title": "Create a Bulleted Unordered List",
"description": [
"HTML has a special element for creating <code>unordered lists</code>, or bullet point style lists.",
"Unordered lists start with an opening <code><ul></code> element, followed by any number of <code><li></code> elements. Finally, unordered lists close with a <code></ul></code>",
"For example: ",
"<blockquote><ul><br> <li>milk</li><br> <li>cheese</li><br></ul></blockquote>",
"would create a bullet point style list of \"milk\" and \"cheese\".",
"<hr>",
"Remove the last two <code>p</code> elements and create an unordered list of three things that cats love at the bottom of the page."
],
"tests": [
{
"text": "Create a <code>ul</code> element.",
"testString": "assert($(\"ul\").length > 0, 'Create a <code>ul</code> element.');"
},
{
"text": "You should have three <code>li</code> elements within your <code>ul</code> element.",
"testString": "assert($(\"ul li\").length > 2, 'You should have three <code>li</code> elements within your <code>ul</code> element.');"
},
{
"text": "Make sure your <code>ul</code> element has a closing tag.",
"testString": "assert(code.match(/<\\/ul>/gi) && code.match(/<ul/gi) && code.match(/<\\/ul>/gi).length === code.match(/<ul/gi).length, 'Make sure your <code>ul</code> element has a closing tag.');"
},
{
"text": "Make sure your <code>li</code> elements have closing tags.",
"testString": "assert(code.match(/<\\/li>/gi) && code.match(/<li[\\s>]/gi) && code.match(/<\\/li>/gi).length === code.match(/<li[\\s>]/gi).length, 'Make sure your <code>li</code> elements have closing tags.');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" <p>Click here to view more <a href=\"#\">cat photos</a>.</p>",
" ",
" <a href=\"#\"><img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\"></a>",
" ",
" <p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>",
" <p>养猫有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,猫咪会到处掉毛,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,猫咪慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08828",
"title": "Create an Ordered List",
"description": [
"HTML has another special element for creating <code>ordered lists</code>, or numbered lists.",
"Ordered lists start with an opening <code><ol></code> element, followed by any number of <code><li></code> elements. Finally, ordered lists close with a <code></ol></code>",
"For example:",
"<blockquote><ol><br> <li>Garfield</li><br> <li>Sylvester</li><br></ol></blockquote>",
"would create a numbered list of \"Garfield\" and \"Sylvester\".",
"<hr>",
"Create an ordered list of the top 3 things cats hate the most."
],
"tests": [
{
"text": "You should have an ordered list for \"Top 3 things cats hate:\"",
"testString": "assert((/Top 3 things cats hate:/i).test($(\"ol\").prev().text()), 'You should have an ordered list for \"Top 3 things cats hate:\"');"
},
{
"text": "You should have an unordered list for \"Things cats love:\"",
"testString": "assert((/Things cats love:/i).test($(\"ul\").prev().text()), 'You should have an unordered list for \"Things cats love:\"');"
},
{
"text": "You should have only one <code>ul</code> element.",
"testString": "assert.equal($(\"ul\").length, 1, 'You should have only one <code>ul</code> element.');"
},
{
"text": "You should have only one <code>ol</code> element.",
"testString": "assert.equal($(\"ol\").length, 1, 'You should have only one <code>ol</code> element.');"
},
{
"text": "You should have three <code>li</code> elements within your <code>ul</code> element.",
"testString": "assert.equal($(\"ul li\").length, 3, 'You should have three <code>li</code> elements within your <code>ul</code> element.');"
},
{
"text": "You should have three <code>li</code> elements within your <code>ol</code> element.",
"testString": "assert.equal($(\"ol li\").length, 3, 'You should have three <code>li</code> elements within your <code>ol</code> element.');"
},
{
"text": "Make sure your <code>ul</code> element has a closing tag.",
"testString": "assert(code.match(/<\\/ul>/g) && code.match(/<\\/ul>/g).length === code.match(/<ul>/g).length, 'Make sure your <code>ul</code> element has a closing tag.');"
},
{
"text": "Make sure your <code>ol</code> element has a closing tag.",
"testString": "assert(code.match(/<\\/ol>/g) && code.match(/<\\/ol>/g).length === code.match(/<ol>/g).length, 'Make sure your <code>ol</code> element has a closing tag.');"
},
{
"text": "Make sure your <code>li</code> element has a closing tag.",
"testString": "assert(code.match(/<\\/li>/g) && code.match(/<li>/g) && code.match(/<\\/li>/g).length === code.match(/<li>/g).length, 'Make sure your <code>li</code> element has a closing tag.');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" <p>Click here to view more <a href=\"#\">cat photos</a>.</p>",
" ",
" <a href=\"#\"><img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\"></a>",
" ",
" <p>Things cats love:</p>",
" <ul>",
" <li>cat nip</li>",
" <li>laser pointers</li>",
" <li>lasagna</li>",
" </ul>",
" <p>Top 3 things cats hate:</p>",
" ",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08829",
"title": "Create a Text Field",
"description": [
"Now let's create a web form.",
"Input elements are a convenient way to get input from your user.",
"You can create a text input like this:",
"<code><input type=\"text\"></code>",
"Note that <code>input</code> elements are self-closing.",
"<hr>",
"Create an <code>input</code> element of type <code>text</code> below your lists."
],
"tests": [
{
"text": "Your app should have an <code>input</code> element of type <code>text</code>.",
"testString": "assert($(\"input[type=text]\").length > 0, 'Your app should have an <code>input</code> element of type <code>text</code>.');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" <p>Click here to view more <a href=\"#\">cat photos</a>.</p>",
" ",
" <a href=\"#\"><img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\"></a>",
" ",
" <p>Things cats love:</p>",
" <ul>",
" <li>cat nip</li>",
" <li>laser pointers</li>",
" <li>lasagna</li>",
" </ul>",
" <p>Top 3 things cats hate:</p>",
" <ol>",
" <li>flea treatment</li>",
" <li>thunder</li>",
" <li>other cats</li>",
" </ol>",
" ",
" ",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedf08830",
"title": "Add Placeholder Text to a Text Field",
"description": [
"Placeholder text is what is displayed in your <code>input</code> element before your user has inputted anything.",
"You can create placeholder text like so:",
"<code><input type=\"text\" placeholder=\"this is placeholder text\"></code>",
"<hr>",
"Set the <code>placeholder</code> value of your text <code>input</code> to \"cat photo URL\"."
],
"tests": [
{
"text": "Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.",
"testString": "assert($(\"input[placeholder]\").length > 0, 'Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.');"
},
{
"text": "Set the value of your placeholder attribute to \"cat photo URL\".",
"testString": "assert($(\"input\") && $(\"input\").attr(\"placeholder\") && $(\"input\").attr(\"placeholder\").match(/cat\\s+photo\\s+URL/gi), 'Set the value of your placeholder attribute to \"cat photo URL\".');"
},
{
"text": "The finished <code>input</code> element should have valid syntax.",
"testString": "assert($(\"input[type=text]\").length > 0 && code.match(/<input((\\s+\\w+(\\s*=\\s*(?:\".*?\"|'.*?'|[\\^'\">\\s]+))?)+\\s*|\\s*)\\/?>/gi), 'The finished <code>input</code> element should have valid syntax.');"
}
],
"challengeType": 0,
"guideUrl": "https://guide.freecodecamp.org/certificates/add-placeholder-text-to-a-text-field",
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" <p>Click here to view more <a href=\"#\">cat photos</a>.</p>",
" ",
" <a href=\"#\"><img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\"></a>",
" ",
" <p>Things cats love:</p>",
" <ul>",
" <li>cat nip</li>",
" <li>laser pointers</li>",
" <li>lasagna</li>",
" </ul>",
" <p>Top 3 things cats hate:</p>",
" <ol>",
" <li>flea treatment</li>",
" <li>thunder</li>",
" <li>other cats</li>",
" </ol>",
" <input type=\"text\">",
"</main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aede08830",
"title": "Create a Form Element",
"description": [
"You can build web forms that actually submit data to a server using nothing more than pure HTML. You can do this by specifying an action on your <code>form</code> element.",
"For example:",
"<code><form action=\"/url-where-you-want-to-submit-form-data\"></form></code>",
"<hr>",
"Nest your text field inside a <code>form</code> element, and add the <code>action=\"/submit-cat-photo\"</code> attribute to the form element."
],
"tests": [
{
"text": "Nest your text input element within a <code>form</code> element.",
"testString": "assert($(\"form\") && $(\"form\").children(\"input\") && $(\"form\").children(\"input\").length > 0, 'Nest your text input element within a <code>form</code> element.');"
},
{
"text": "Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code>",
"testString": "assert($(\"form\").attr(\"action\") === \"/submit-cat-photo\", 'Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code>');"
},
{
"text": "Make sure your <code>form</code> element has well-formed open and close tags.",
"testString": "assert(code.match(/<\\/form>/g) && code.match(/<form [^<]*>/g) && code.match(/<\\/form>/g).length === code.match(/<form [^<]*>/g).length, 'Make sure your <code>form</code> element has well-formed open and close tags.');"
}
],
"challengeType": 0,
"files": {
"indexhtml": {
"key": "indexhtml",
"ext": "html",
"name": "index",
"contents": [
"<h2>CatPhotoApp</h2>",
"<main>",
" <p>Click here to view more <a href=\"#\">cat photos</a>.</p>",
" ",
" <a href=\"#\"><img src=\"https://bit.ly/fcc-relaxing-cat\" alt=\"A cute orange cat lying on its back.\"></a>",
" ",
" <p>Things cats love:</p>",
" <ul>",
" <li>cat nip</li>",
" <li>laser pointers</li>",
" <li>lasagna</li>",
" </ul>",
" <p>Top 3 things cats hate:</p>",
" <ol>",
" <li>flea treatment</li>",
" <li>thunder</li>",
" <li>other cats</li>",
" </ol>",
" <input type=\"text\" placeholder=\"cat photo URL\">",
"<main>"
],
"head": [],
"tail": []
}
}
},
{
"id": "bad87fee1348bd9aedd08830",
"title": "Add a Submit Button to a Form",
"description": [
"Let's add a <code>submit</code> button to your form. Clicking this button will send the data from your form to the URL you specified with your form's <code>action</code> attribute.",
"Here's an example submit button:",
"<code><button type=\"submit\">this button submits the form</button></code>",
"<hr>",
"Add a button as the last element of your <code>form</code> element with a type of <code>submit</code>, and \"Submit\" as its text."
],
"tests": [
{
"text": "Your form should have a button inside it.",
"testString": "assert($(\"form\").children(\"button\").length > 0, 'Your form should have a button inside it.');"
},
{
"text": "Your submit button should have the attribute <code>type</code> set to <code>submit</code>.",
"testString": "assert($(\"button\").attr(\"type\") === \"submit\", 'Your submit button should have the attribute <code>type</code> set to <code>submit</code>.');"
},
{
"text": "Your submit button should only have the text \"Submit\".",