JQuery: on method (Team Treehouse Notes)

Instead of having 2 separate event listeners for click and keypress, use the on method to combine the two:

$('#element').on('click keypress', function() {
//do stuff when element is clicked OR when a key is pressed
});

Comments

Popular posts from this blog

Code Wars: Data Reverse (6 kyu)

Code Wars: longest_palindrome (6 kyu)

Code Wars: Find the odd int