Q
How to bind a click event handler to all<code><button> elements using jQuery?

Answer & Solution

Answer: Option D
Solution:
$('button').on('click', function() {...});
Related Questions on Average

How to unbind a specific click event handler function from all<code><button> elements using jQuery?

A). $('button').unbind('click', clickHandler);

B). $('button').off('click', clickHandler);

C). $('button').removeEventListener('click', clickHandler);

D). $('button').off(clickHandler);

Which jQuery method is used to bind event handlers to elements that are currently matching a selector?

A). $(selector).on();

B). $(selector).bind();

C). $(selector).live();

D). $(selector).delegate();

Which method is used to bind a one-time event handler to a DOM element in jQuery?

A). $('element').once();

B). $('element').one();

C). $('element').bindOnce();

D). $('element').on('once', function() {...});

Which jQuery method is used to bind event handlers to elements with a specific CSS class?

A). $('.class').on();

B). $('.class').attach();

C). $('.class').bind();

D). $('.class').delegate();

Which method is used to bind multiple event handlers to the same DOM element in jQuery?

A). $('element').addHandlers({...});

B). $('element').on({...});

C). $('element').bind({...});

D). $('element').attachHandlers({...});

How to bind a keydown event handler to the document using jQuery?

A). $(document).keydown(function(event) {...});

B). document.addEventListener('keydown', function(event) {...});

C). $('document').on('keydown', function(event) {...});

D). $('document').keydown(function(event) {...});

How to bind a change event handler to all<select> elements using jQuery?

A). $('select').on('change', function() {...});

B). $('select').addEventListener('change', function() {...});

C). $('select').bind('change', function() {...});

D). $('select').change(function() {...});

Which jQuery method is used to bind event handlers to the document itself?

A). $(document).on();

B). $(document).bind();

C). $(document).attach();

D). $(document).delegate();

How to bind a submit event handler to all<form> elements using jQuery?

A). $('form').on('submit', function() {...});

B). $('form').addEventListener('submit', function() {...});

C). $('form').bind('submit', function() {...});

D). $('form').submit(function() {...});

How to bind a scroll event handler to the window using jQuery?

A). $(window).scroll(function() {...});

B). window.addEventListener('scroll', function() {...});

C). $('window').bind('scroll', function() {...});

D). $('window').on('scroll', function() {...});