Internet Explorer 8错误-对象不支持此属性或方法

问题描述 投票:0回答:1

当我尝试提交表单时,我在IE上遇到错误。错误如下,但我不知道如何解决。

IE错误-对象不支持此属性或方法-Mailbox-details.php-行:397-字符:5

下面是代码段...

第397行是从底部开始的第3行... jQuery_1_7_1(“#store_notes”)。val(“”);

 <script>
/*
$("input").click( function(e) {
    alert();
    e.preventDefault();
})
*/
jQuery(document).ready(function( $ ) {
    jQuery( "#renewal_date" ).datepicker({ dateFormat: "mm-dd-yy" });       
    //alert(jQuery_1_7_1.ui);
});

    ///////////////////////////////////////////////////////////
    // save
    ///////////////////////////////////////////////////////////
    jQuery_1_7_1("#save_button").click( function() {
        var lErrorMsg = checkMandatoryFields();
        // if there's no errors, submit
        if ( lErrorMsg == '' ) {
            saveData();
        } else {
            // if not, show errors
            jQuery_1_7_1(".formRowError").html( lErrorMsg + '<br><br>' );
            jQuery_1_7_1(".formRowError").fadeIn();
            var new_position = jQuery_1_7_1('.formRowError').offset();
        window.scrollTo(new_position.left,new_position.top);
        }
    });

    function saveData() {   
        // check checkbox values
        if ( jQuery_1_7_1("#notify_email_package").attr("checked") == "checked" )
            notify_email_package = 1;
        else
            notify_email_package = 0;
        if ( jQuery_1_7_1("#notify_text_package").attr("checked") == "checked" )
            notify_text_package = 1;
        else
            notify_text_package = 0;
        if ( jQuery_1_7_1("#notify_email_mail").attr("checked") == "checked" )
            notify_email_mail = 1;
        else
            notify_email_mail = 0;
        if ( jQuery_1_7_1("#notify_text_mail").attr("checked") == "checked" )
            notify_text_mail = 1;
        else
            notify_text_mail = 0;

        // check radio values
        if ( jQuery_1_7_1("#rental_status_rented").attr("checked") == "checked" )
            rental_status = 1;
        else if ( jQuery_1_7_1("#rental_status_vacant").attr("checked") == "checked" )
            rental_status = 0
        else
            rental_status = '';

        var dataString = 'id_mailbox=<?php echo $lIdMailbox; ?>' +
                                            '&mailbox_no=<?php echo $row['mailbox_no']; ?>' +
                                            '&customer_name=' + jQuery_1_7_1("#customer_name").val() + 
                                            '&customer_address=' + jQuery_1_7_1("#customer_address").val() +
                                            '&customer_zip=' + jQuery_1_7_1("#customer_zip").val() +
                                            '&customer_home_phone=' + jQuery_1_7_1("#customer_home_phone").val() +
                                            '&customer_mobile_phone=' + jQuery_1_7_1("#customer_mobile_phone").val() +
                                            '&customer_email=' + jQuery_1_7_1("#customer_email").val() +
                                            '&business_name=' + jQuery_1_7_1("#business_name").val() +
                                            '&business_address=' + jQuery_1_7_1("#business_address").val() +
                                            '&business_zip=' + jQuery_1_7_1("#business_zip").val() +
                                            '&business_phone=' + jQuery_1_7_1("#business_phone").val() +
                                            '&notify_email_package=' + notify_email_package +
                                            '&notify_text_package=' + notify_text_package +
                                            '&notify_email_mail=' + notify_email_mail +
                                            '&notify_text_mail=' + notify_text_mail +
                                            '&id_mailbox_size=' + jQuery_1_7_1("#id_mailbox_size").val() +
                                            '&rental_status=' + rental_status +
                                            '&id_rental_period=' + jQuery_1_7_1("#id_rental_period").val() +
                                            '&renewal_date=' + jQuery_1_7_1("#renewal_date").val() +
                                            '&price_override=' + jQuery_1_7_1("#price_override").val() +
                                            '&store_notes=' + jQuery_1_7_1("#store_notes").val();
        jQuery_1_7_1.ajax({
            type: "POST",
            url: "data/update-mailbox.php",
            data: dataString,
            success: function(data) {
                // go back to list
                window.location = "manage-mailboxes.php";
            }
        });
    }


    function checkMandatoryFields() {
        var lOk = true;
        var lErrorMsg = "";


        // check if email is valid
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        var lEmailValid = emailReg.test( jQuery_1_7_1('#customer_email').val() );
        // if email is not valid
        if (!lEmailValid) {
            lOk = false;
            lErrorMsg = lErrorMsg + "<br>The email address is not valid.";
        }

        // check if email notification is active but there's no email
        if ( ( ( jQuery_1_7_1("#notify_email_package").attr("checked") == "checked" ) || ( jQuery_1_7_1("#notify_email_mail").attr("checked") == "checked" ) ) && 
        ( ( jQuery_1_7_1("#customer_email").val() == undefined ) || ( jQuery_1_7_1("#customer_email").val() == '' ) ) ) {
            lOk = false;
            lErrorMsg = lErrorMsg + "<br>You must enter an email address or uncheck the email alert settings.";
        }

        // check if email notification is active but there's no email
        if ( ( ( jQuery_1_7_1("#notify_text_package").attr("checked") == "checked" ) || ( jQuery_1_7_1("#notify_text_mail").attr("checked") == "checked" ) ) && 
        ( ( jQuery_1_7_1("#customer_mobile_phone").val() == undefined ) || ( jQuery_1_7_1("#customer_mobile_phone").val() == '' ) ) ) {
            lOk = false;
            lErrorMsg = lErrorMsg + "<br>You must enter a mobile number or uncheck the sms alert settings.";
        }

        return lErrorMsg;
    }

    ///////////////////////////////////////////////////////////
    // if user changes to vacant, clear all info
    ///////////////////////////////////////////////////////////
    jQuery_1_7_1("#rental_status_vacant").click( function() {
        jQuery_1_7_1("#customer_name").val( "" ) + 
        jQuery_1_7_1("#customer_address").val( "" ) +
        jQuery_1_7_1("#customer_zip").val( "" ) +
        jQuery_1_7_1("#customer_home_phone").val( "" ) +
        jQuery_1_7_1("#customer_mobile_phone").val( "" ) +
        jQuery_1_7_1("#customer_email").val( "" ) +
        jQuery_1_7_1("#business_name").val( "" ) +
        jQuery_1_7_1("#business_address").val( "" ) +
        jQuery_1_7_1("#business_zip").val( "" ) +
        jQuery_1_7_1("#business_phone").val( "" ) +
        jQuery_1_7_1("#notify_email_package").attr("checked", false ) +
        jQuery_1_7_1("#notify_text_package").attr("checked", false ) +
        jQuery_1_7_1("#notify_email_mail").attr("checked", false ) +
        jQuery_1_7_1("#notify_text_mail").attr("checked", false ) +
        jQuery_1_7_1("#id_mailbox_size").val( "" ) +
        jQuery_1_7_1("#id_rental_period").val( "" ) +
        jQuery_1_7_1("#renewal_date").val( "" ) +
        jQuery_1_7_1("#price_override").val( "" ) +
        jQuery_1_7_1("#store_notes").val( "" );
    });
</script>
jquery forms internet-explorer submit
1个回答
0
投票

如果您对项目使用编译,则可以考虑在入口点的顶部添加

import 'core-js'

目前core-js polyfill library是提供跨浏览器支持的最简单方法

© www.soinside.com 2019 - 2024. All rights reserved.