Skip to main content
search
0
WordPress

jQueryエラー$ is not a function. WordPressの no conflictモード

By 2024年7月16日No Comments

<script></script>内にjQueryのコードを書いていると$ is not a function.~~のエラーが表示される。

document.addEventListener(“DOMContentLoaded”, function() {}

としても$が使えないと言われる。そもそもこれはWordPressのデフォルトの設定でそうなっているので、

jQuery(function($) {}
で囲んで実行すると動く。