JavaScript
You need t ...
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
You need to add a click event handler for an element with class "podBlock" inside the block id #myBlock. Select all correct options.
$('#myBlock').on('click', '.podBlock ', function(){ //code });
$('#myBlock .podBlock').on('click', function(){ //code });
$('#myBlock .podBlock').on('click', function(e){ if($(e.target).hasClass('podBlock')){ //code } });
$('#myBlock').on('click', function(e){ if($(e.target).hasClass('podBlock')){ //code } });
Explanation
[ $('#myBlock .podBlock').on('click', function ] will add event handler to every element, what is not necessary, and it will negatively affect the performance of the script.
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
J
avaScript
Quiz
Login to learn JavaScript
or
Read more about
JavaScript Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment