嗨我的问题是,('id_form').submit()
没有被触发它在Chrome上工作正常,但在firefox上却没有。我知道发布了类似的问题,但响应始终是一个直接附在身上的表单我在你的HTML中看到的不是我的情况
<body>
<div class="sitecontainer">
form-vehicule
<div class="body">
<!-- NBA_dataLayer_v1 -->
<section class="slice-pn7 slice-full-size no-margin-top">
<div class="header">
<header>
<div>
<h1><span class="bold">Tasación Peugeot</span></h1>
</div>
</header>
</div>
</section>
<div class="container-fluid ">
<form id="form-vehicule" class="form-vehicule" name="form_vehicule" method="post" action="http://tasacion.peugeot.shakazoola.com/">
<div class="row">
<div class="col-xs-12">
<h2 class="text-left">INDICA EL NÚMERO DE PUERTAS DE TU VEHÍCULO</h2>
</div>
</div>
<div class="row ">
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
<button type="button" data-scope="select_vo_porte" class="button button-porte-boite btn-cta grey select_vo_porte scrollPage" style="" value="3">3 puertas</button>
</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
<button type="button" data-scope="select_vo_porte" class="button button-porte-boite btn-cta grey select_vo_porte scrollPage" style="" value="5">5 puertas</button>
</div>
</div>
<div class="row margin-top" id="toScroll">
<div class="col-xs-12">
<h2 class="text-left">SELECCIONA EL TIPO DE CAJA DE CAMBIO</h2>
</div>
</div>
<div class="row " id="resultBoite">
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
<button type="button" data-scope="select_vo_boite" class="button button-porte-boite btn-cta dark-blue" style="" value="1">Manual</button>
</div>
</div>
<div class="row" style="margin-top:2em;">
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="inline-cta">
<a id="back_slide" class="cta btn-cta arrow grey previous">
<span class="content-cta">ANTERIOR</span>
</a>
</div>
</div>
<div class="col-xs-6 col-sm-4 col-sm-offset-4 col-md-3 col-md-offset-6 col-lg-2 col-lg-offset-8">
<div class="inline-cta">
<a id="submit_slide" class="cta btn-cta arrow light-blue next" onclick="javascript:void(0);">
<span class="content-cta"> SIGUIENTE</span>
</a>
</div>
</div>
</div>
<div>
</div>
</form>
</div>
</div><!-- end body !-->
</div>
</body>
所以('#form-vehicule').appendTo('body');
无法正常工作以使提交成功,它实际上将表单移动到正文的末尾
您可以在此网址http://tasacion.peugeot.shakazoola.com/assets/js/formcheck.js
答案 0 :(得分:0)
我想你想用它来把它附加到正文类:
$('#form-vehicule').appendTo('.body');
对于表单提交,您应该使用确保绑定点击事件类似于SK Jajoriya建议的方式:
$(document).on('click', '#submit_slide', function() {
$(this).parents('form').submit();
});
或者如果是按钮元素:
$(document).on('click', '.button', function() {
$(this).parents('form').submit();
});
使用此方法,无论表单在加载页面时是否存在,还是在事件绑定发生后注入表单,都会触发绑定的单击事件。
希望这有帮助。