chore(learn): Applied MDX format to Chinese curriculum files (#40462)

This commit is contained in:
Randell Dawson
2020-12-16 00:37:30 -07:00
committed by GitHub
parent 873fce02a2
commit 9ce4a02a41
1665 changed files with 58741 additions and 88042 deletions

View File

@@ -1,116 +1,37 @@
---
id: bad87fee1348bd9aed708826
title: 使用 jQuery 删除元素
challengeType: 6
forumTopicId: 18262
title: 使用 jQuery 删除元素
---
## Description
<section id='description'>
# --description--
现在学习用 jQuery 从页面移除 HTML 标签。
jQuery 有一个<code>.remove()</code>方法,能完全移除 HTML 标签。
请用<code>.remove()</code>方法从页面移除<code>target4</code>标签。
</section>
## Instructions
<section id='instructions'>
jQuery 有一个`.remove()`方法,能完全移除 HTML 标签。
</section>
请用`.remove()`方法从页面移除`target4`标签。
## Tests
<section id='tests'>
# --hints--
```yml
tests:
- text: 用 jQuery 从页面中移除<code>target4</code>标签。
testString: assert($("#target4").length === 0 && code.match(/\$\(["']#target4["']\).remove\(\)/g));
- text: 仅用 jQuery 移除该标签。
testString: assert(code.match(/id="target4/g) && !code.match(/<!--.*id="target4".*-->/g) && $("#right-well").length > 0);
用 jQuery 从页面中移除`target4`标签。
```js
assert(
$('#target4').length === 0 && code.match(/\$\(["']#target4["']\).remove\(\)/g)
);
```
</section>
仅用 jQuery 移除该标签。
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target1").prop("disabled", true);
});
</script>
<!-- 请修改本行以上的代码 -->
<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>
```js
assert(
code.match(/id="target4/g) &&
!code.match(/<!--.*id="target4".*-->/g) &&
$('#right-well').length > 0
);
```
</div>
# --solutions--
</section>
## Solution
<section id='solution'>
```html
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target1").prop("disabled", true);
$("#target4").remove();
});
</script>
<!-- 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>
```
</section>