0

Internet Explorer 7/8 でいくつかの入力にフォーカスしてボックスを選択しようとすると、同じ古いエラーが発生します。

jQuery コードは次のとおりです。

$("#planner input, #planner select").on("focus",function() {
            panel = $(this).parents(".panel").first();
            if (!panel.hasClass("active")) {
                tab = panel.data("tab");
                $("#planner .tabs li[data-tab="+tab+"] a").trigger("click");
            }
        }); 

誰でも私を助けることができますか?

編集:

ここにコード全体を貼り付けます

<script>

    $(document).ready(function(){

        $("#planner .tabs a").click(function() {
            $(this).parents("#planner").find(".panel.active").removeClass("active");
            $(this).parents("#planner").find(".tabs li.active").removeClass("active");
            $(this).parent().addClass("active");
            tab = $(this).parents("#planner").find(".tabs li").index($(this).parent());
            panel = $(this).parents("#planner").find(".panel");
            $(panel[tab]).addClass("active");
        }); 

        $("#planner #quote").validate({
        ignore: "",         
        errorPlacement: function(error, element) {
        error.appendTo(element.closest(".item"));
        }           
        });

        $("#planner input, #planner select").on("focus" , function() {
            panel = $(this).parents(".panel").first();
            if (!panel.hasClass("active")) {
                tab = panel.data("tab");
                $("#planner .tabs li[data-tab="+tab+"] a").trigger("click");
            }
        });

});
</script>
4

2 に答える 2

0

「フォーカス」を「アクティブ」に置き換えることはできますか?

アップデート:

次はie8で私のために働きます、あなたのイベント内の問題でなければなりません

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <title></title>
    <script language="javascript">

        $(document).ready(function () {
            $("#planner input, #planner select").on("focus", function () {
                alert('focus');
            });
        });

    </script>
</head>
<body>
    <div id="planner">
        <input type="text"/>
    </div>
</body>
</html>
于 2013-10-24T10:31:01.563 に答える