(Events 04) Module 5 Quiz

SoloLearn jQuery 번역


QUIZ

  • Fill in the blanks to add an event handler to the paragraph.
    • p에 이벤트 핸들러를 추가해라.
$("p").on("click", function() {
   // some code
});


  • What will be the output after the div is clicked two times?
    • div가 두 번 클릭된 후의 출력은 무엇인가?
<div>1</div>

<script>
   $("div").click(function() {
      $("div").text($("div").text() + 1);
   });
</script>

111


  • Fill in the blanks to remove the “click” event handler from all <a> elements.
    • 모든 <a> element의 “click” 이벤트 핸들러를 제거해라.
$("a").off("click");


  • How many “a” characters will be output after the div is clicked three times?
    • div가 세 번 클릭된 후, 몇 개의 “a” 문자가 출력되는가?
<div>a</div>

<script>
   $("div").click(function() {
      $("div").append("a");
      $("div").off("click");
   });
</script>

2