0

IE以外のすべてで完全に正常に機能するjQueryコードがいくつかあります。トグルアクションはトリガーされず、フッター要素を表示または非表示にしません。

条件付きのifandelseステートメントを使用してtoggleの代わりにhide()とshow()を使用しようとしました。また、スクリプトタグに言語要素とsrc要素を追加しようとしましたが、これらの角度はどちらも機能しませんでした。最新のDoctypeを宣言し、最新バージョンのWordPressを使用しています。

これがIEで機能しない理由を誰かが理解できますか?

<script>
$(document).ready(function() {
    $("#clickme").click(function() {
        event.preventDefault()
        $("#footer").toggle(2000);
        $('#menu, #menu2, #menu3, #menu4').hide('slow');
        $(this).html(($('#clickme').text() == 'Show') ? 'Hide' : 'Show');
        $(this).toggleClass("active");
        $(this).attr("title", ($(this).hasClass("active") ? "Show" : "Hide") + " the menu");
    });
});​
</script>
4

1 に答える 1

3

使用しています

$("#clickme").click(function() {
    event.preventDefault();//^ event parameter is missing, so causing error
    // ...
});

そのはず

$("#clickme").click(function(event) {
    event.preventDefault(); // ^
    // ...
});
于 2012-11-12T17:19:34.627 に答える