Uncaught TypeError: htmx.defineExtension is not a function

21 views Asked by At

When using HTMX in the console, you see the error

Uncaught TypeError: htmx.defineExtension is not a function

Using HTMX debug does not present any additional information.

1

There are 1 answers

0
Andrew Killen On BEST ANSWER

First make sure you are loading the response-targets.js Extension of HTMX.

If it is still a problem, there is a good chance that you have chosen an html ID that breaks HTMX. example:

<div id="htmx"></div>

This confuses htmx and leaves it unable to to know the difference between its javascript, which starts htmx. and the ID of the html which is also htmx.

to resolve change this id so it is not htmx

<div id="new-htmx-id"></div>