.click() Event

.click() Event

  • Attaches an event handler function to an element that is triggered when users click on the element with their mouse

Example

$(() => {
  // listen for .click() on #toggleBtn
  $('#toggleBtn').click(() => {
    $('.box').slideToggle()
  })
})

JS Bin on jsbin.com