PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 02?

You develop an HTML5 webpage. You have the following JavaScript code:

You need to handle the click event when a user clicks the show/Dialog button.
Which code segment should you insert at line 02?

PrepAway - Latest Free Exam Questions & Answers

A.
$ (document).trigger(“click”, “#showDialog”, function (e) {

B.
$ (document).on (“#showDialog”, “click”, function (e) {

C.
$(document).toggle(“click”, “#showDialog”, function (e) {

D.
$(document).on(“click”, “#showDialog”, function (e) {

Explanation:

3 Comments on “Which code segment should you insert at line 02?

    1. Jacob says:

      http://api.jquery.com/trigger/ says that trigger will “Execute all handlers and behaviors attached to the matched elements for the given event type.” and the websites section for “.on” says that it will “Attach an event handler function for one or more events to the selected elements.”

      It’s a little confusing to me too. The question doesn’t say whether we’re actually triggering the event or if we’re just attaching it.




      0



      0

Leave a Reply