実行されることのないjQueryコードがあります。私は、ブラウザのコンソールで同じコードをしようとしているので、私はなぜ私のコードは決して実行されて理解していない。jQueryコードは実行されていません
HTMLのCODE:
<div id="ans">
<label>{$valeur}</label>
<div class="radio">
{foreach $reponse as $ligne}
<input type="radio" name="answers" id="answer_{[email protected]}" value="{[email protected]}"/><label for="answer_{[email protected]}">$ligne</label><br />
{/foreach}
</div>
</div>
更新:
document.addEventListener("DOMContentLoaded", function() {
setTimeout(function(){
$.post(ajax_path+"bla.php", {} , function(response) {
$('#quest').html(response);
$('#quest').collapse("show");
})
.fail(function(jqXHR, textStatus, errorThrown) {
{/literal}
toastr.error(__['Error'], __['Error']);
{literal}
});
}, 50);
$('input[name=answers]').on('change', function() {
$(this).closest("form").submit();
});
});
も代わりに文書のウィンドウを使用することができますjQueryはおそらく 'DOMContentLoaded'の後にロードされます。 '$(document).ready'を使用してください –
なぜバニラJSをjQueryと混ぜるのですか? –
既に試してみましたが、うまくいきません。 – Mulan