freeCodeCamp/curriculum/challenges/chinese/03-front-end-libraries/jquery/remove-an-element-using-jqu...

658 B

id title challengeType forumTopicId
bad87fee1348bd9aed708826 使用 jQuery 删除元素 6 18262

--description--

现在学习用 jQuery 从页面移除 HTML 标签。

jQuery 有一个.remove()方法,能完全移除 HTML 标签。

请用.remove()方法从页面移除target4标签。

--hints--

用 jQuery 从页面中移除target4标签。

assert(
  $('#target4').length === 0 && code.match(/\$\(["']#target4["']\).remove\(\)/g)
);

仅用 jQuery 移除该标签。

assert(
  code.match(/id="target4/g) &&
    !code.match(/<!--.*id="target4".*-->/g) &&
    $('#right-well').length > 0
);

--solutions--