2018-10-10 18:03:03 -04:00
---
id: bad87fee1348bd9aec908857
title: Use Comments to Clarify Code
challengeType: 0
2019-08-28 16:26:13 +03:00
forumTopicId: 18347
2018-10-10 18:03:03 -04:00
localeTitle: Использовать комментарии для уточнения кода
---
## Description
2019-08-28 16:26:13 +03:00
< section id = 'description' >
Когда мы начнем использовать jQuery, мы изменим HTML-элементы без необходимости их изменения в HTML. Давайте убедиться, что все знают, что они не должны фактически изменять какой-либо из этого кода напрямую. Помните, что вы можете начинать комментарий с < code > < !--< / code > и заканчивать комментарий с помощью < code > --> < / code > Добавить комментарий в верхней части вашего HTML, который говорит < code > Only change code above this line.< / code >
< / section >
2018-10-10 18:03:03 -04:00
## Instructions
2019-08-28 16:26:13 +03:00
< section id = 'instructions' >
2018-10-10 18:03:03 -04:00
< / section >
## Tests
< section id = 'tests' >
```yml
tests:
2019-08-28 16:26:13 +03:00
- text: Start a comment with < code > & #60 ; !--</ code > at the top of your HTML.
testString: assert(code.match(/^\s*<!--/));
- text: Your comment should have the text < code > Only change code above this line</ code > .
testString: assert(code.match(/<!--(?!(>|->|.*--> .*this line))\s*.*this line.*\s*-->/gi));
- text: Be sure to close your comment with < code > --& #62 ; </ code > .
testString: assert(code.match(/-->.*\n+.+/g));
- text: You should have the same number of comment openers and closers.
testString: assert(code.match(/<!-- /g).length === code.match(/ --> /g).length);
2018-10-10 18:03:03 -04:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'html-seed' >
```html
< div class = "container-fluid" >
< h3 class = "text-primary text-center" > jQuery Playground< / h3 >
< div class = "row" >
< div class = "col-xs-6" >
< h4 > #left -well</ h4 >
< div class = "well" id = "left-well" >
< button class = "btn btn-default target" id = "target1" > #target1 </ button >
< button class = "btn btn-default target" id = "target2" > #target2 </ button >
< button class = "btn btn-default target" id = "target3" > #target3 </ button >
< / div >
< / div >
< div class = "col-xs-6" >
< h4 > #right -well</ h4 >
< div class = "well" id = "right-well" >
< button class = "btn btn-default target" id = "target4" > #target4 </ button >
< button class = "btn btn-default target" id = "target5" > #target5 </ button >
< button class = "btn btn-default target" id = "target6" > #target6 </ button >
< / div >
< / div >
< / div >
< / div >
```
< / div >
< / section >
## Solution
< section id = 'solution' >
2019-08-28 16:26:13 +03:00
```html
<!-- Only change code above this line. -->
< div class = "container-fluid" >
< h3 class = "text-primary text-center" > jQuery Playground< / h3 >
< div class = "row" >
< div class = "col-xs-6" >
< h4 > #left -well</ h4 >
< div class = "well" id = "left-well" >
< button class = "btn btn-default target" id = "target1" > #target1 </ button >
< button class = "btn btn-default target" id = "target2" > #target2 </ button >
< button class = "btn btn-default target" id = "target3" > #target3 </ button >
< / div >
< / div >
< div class = "col-xs-6" >
< h4 > #right -well</ h4 >
< div class = "well" id = "right-well" >
< button class = "btn btn-default target" id = "target4" > #target4 </ button >
< button class = "btn btn-default target" id = "target5" > #target5 </ button >
< button class = "btn btn-default target" id = "target6" > #target6 </ button >
< / div >
< / div >
< / div >
< / div >
2018-10-10 18:03:03 -04:00
```
2019-08-28 16:26:13 +03:00
2018-10-10 18:03:03 -04:00
< / section >