typeerror:e在jquery核心js文件中未定义

时间:2013-11-09 12:40:30

标签: javascript jquery undefined

点击后,我的JS文件中出现了一个神秘的错误。

$('.atcf-submit-campaign-reward-popup-submit').click(function (e) {
    e.preventDefault();
    if (window.newPass) {
        var newReward = reward.clone();
        var count = rewardContainer.find('.atcf-submit-campaign-reward').length;
        newReward.removeClass('static');
        newReward.find('input, select, textarea').val('');
        newReward.find('input, select, textarea').each(function () {
            var label = $(this).prev().attr('for');
            var name = $(this).attr('name');

            name = name.replace(/\[(\d+)\]/, '[' + parseInt(count) + ']');
            label = label.replace(/\[(\d+)\]/, '[' + parseInt(count) + ']');

            $(this)
                .attr('name', name)
                .attr('id', name);

            $(this).siblings('label[for]').remove();
            $(this).siblings('label')
                .attr('name', name)
                .attr('id', name);
        });
        newReward.find('.atcf-submit-campaign-reward-adjust a').removeClass().addClass(String(count));

        newReward.insertBefore($('.atcf-submit-campaign-add-reward')).show();
    } else {
        var count = rewardContainer.find('.atcf-submit-campaign-reward').length - 1;
        $('.atcf-submit-campaign-reward').removeClass('static');
    };

    function passValue(source, set) {
        $(set).val($(source).val());
    }

    function addValue(source, set) {
        $(set).html($(source).val());
    }

    passValue('.reward-popup input#rewards\\[0\\]\\[price\\]', '.atcf-submit-campaign-rewards input#rewards\\[' + parseInt(count) + '\\]\\[price\\]');
    addValue('.reward-popup input#rewards\\[0\\]\\[price\\]', '.atcf-submit-campaign-rewards label#rewards\\[' + parseInt(count) + '\\]\\[price\\]');
    passValue('.reward-popup #rewards\\[0\\]\\[description\\]', '.atcf-submit-campaign-rewards input#rewards\\[' + parseInt(count) + '\\]\\[description\\]');
    addValue('.reward-popup #rewards\\[0\\]\\[description\\]', '.atcf-submit-campaign-rewards label#rewards\\[' + parseInt(count) + '\\]\\[description\\]');
    passValue('.reward-popup input#rewards\\[0\\]\\[limit\\]', '.atcf-submit-campaign-rewards input#rewards\\[' + parseInt(count) + '\\]\\[limit\\]');
    addValue('.reward-popup input#rewards\\[0\\]\\[limit\\]', '.atcf-submit-campaign-rewards label#rewards\\[' + parseInt(count) + '\\]\\[limit\\]');

    var api = $.data($('#main-slider')[0], 'liquidSlider');
    api.adjustHeight(true, api.getHeight());

    $.magnificPopup.close();

    window.newPass = true;
});

最初我认为e是我附加到click函数的事件处理程序,但在尝试了所有可能之后。我正在这里粘贴它以获得一些急需的帮助。

代码的功能:它附加到提交按钮,单击它会从输入字段中获取值并将内容添加到另一个表单字段。

应该附加数据并关闭。当它完成第一部分时,它不会关闭模态并抛出'e is undefined'(jquery-1.10.2.js)错误。

愿意分享任何有助于解决这个问题的事情。

0 个答案:

没有答案