Skip to content

Commit

Permalink
Document parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker authored Aug 21, 2024
1 parent 046b662 commit 488516c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions www/content/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,14 @@ Adds an event listener to an element

* `eventName` - the event name to add the listener for
* `listener` - the listener to add
* `options` - [options](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#options) to add to the event listener (optional)

or

* `target` - the element to add the listener to
* `eventName` - the event name to add the listener for
* `listener` - the listener to add
* `options` - [options](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#options) to add to the event listener (optional)

##### Example

Expand All @@ -331,6 +333,9 @@ or

// add a click listener to the given div
var myEventListener = htmx.on("#my-div", "click", function(evt){ console.log(evt); });

// add a click listener to the given div that should only be invoked once
var myEventListener = htmx.on("#my-div", "click", function(evt){ console.log(evt); }, { once: true });
```

### Method - `htmx.onLoad()` {#onLoad}
Expand Down

0 comments on commit 488516c

Please sign in to comment.