无法使用事件处理程序

时间:2013-10-11 12:49:27

标签: javascript event-handling

我正在使用一个将输入提交到后端的函数来绑定一个按钮 我有html文件,我在其中声明了file.js,其中逻辑实现了我的代码如下:

$(document).ready(function(){
 console.log("1");
$(function() {
    FastClick.load(document.body);

 console.log("1");
});


$('.containerHeader').on('click',function(){
    $that = $(this);
    $that.parent().toggleClass('active');
     console.log("2");
});


$('#contact-form').bind('submit',function( event, submit ){
    var quizAnswer= {};
    event.preventDefault();
    quizAnswer.aa= $('#big-data-form').find('input:radio[name="cc-radio-group"]:checked').val();
    quizAnswer.bb= $('#social-form').find('input:radio[name="ss-radio-group"]:checked').val();
    quizAnswer.cc= $('#cloud-form').find('input:radio[name="ww-radio-group"]:checked').val();
    quizAnswer.dd= $('#mobile-form').find('input:radio[name="tt-radio-group"]:checked').val();
     console.log("3");
    var contactForm = $("#contact-form");
    var contactInfo = {};
    contactInfo.firstName = contactForm.find('input[name="first-name-input"]').val();
    contactInfo.lastName = contactForm.find('input[name="last-name-input"]').val();
    contactInfo.phone = contactForm.find('input[name="phone-input"]').val();
    contactInfo.email = contactForm.find('input[name="email-input"]').val();
    contactInfo.company = contactForm.find('input[name="company-input"]').val();
     console.log("4");

    submitToBackend(contactInfo,quizAnswer);
     console.log("5");

});

0 个答案:

没有答案