WordPress JQueryに[$]記号を利用できない

WordPressを利用して、自分のBLogサイトを構築したいですが、
JQueryの[$]記号を使っても、エラーになってしまい、使用できません。

ちなみに、WordPressにちゃんとJQueryのLibraryをインポートしたことを確認済み。

WordPress達人から理由を教えて頂けると助かります。
2014-04-21 18:00 コメント
已邀请:

ベストアンサー

2

iQi - 面白いアプリを開発中

{ 賛成 }: lujian Lubo

WordPressの場合、[$]記号ではなく、jQueryのObjectを直接に利用することをおすすめです。
どうしても[$]記号を使用したい場合、下記のコードに書く必要があります。

jQuery(document).ready(function($) {
// Inside of this function, $() will work as an alias for jQuery()
// and other libraries also using $ will not be accessible under this shortcut
});


すぐJavaScriptを効く場合、

(function($) {
// Inside of this function, $() will work as an alias for jQuery()
// and other libraries also using $ will not be accessible under this shortcut
})(jQuery);
2014-04-21 18:04 1 コメント

ログインまたは登録してから回答してください

EXIT フルスクリーンモード 回答