0

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

IE 错误 - 对象不支持此属性或方法 -mailbox-details.php - line:397 - Char:5

下面是一个片段...

第 397 行是倒数第三行... 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>
4

1 回答 1

0

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

import 'core-js'

目前core-js polyfill 库是实现跨浏览器支持的最简单方法

于 2019-10-25T17:45:47.457 回答