我有一个表单,当选择单选按钮时我想提交。 我已经尝试了一些使它工作的方法,但它并没有。
我的表单与这里( 只有一个ilustration选项,但原来的选项有 20个选项) 类似:
<form action="http://spartanas.com.br/novo/wp-comments-post.php" method="post" id="votoscommentform" class="comment-form">
<div class="anuncio vitrine">
<a href="http://spartanas.com.br/novo/ninasalvattori/">
<div style="position: absolute; width: 172px; height: 285px;" class="fphover"> </div>
<img src="http://spartanas.com.br/novo/wp-content/plugins/nextcellent-gallery-nextgen-legacy/nggshow.php?pid=982" style="width:172px;height:285px">
</a>
<div class="infos">Nina Salvattori<br>Hotéis e Motéis</div>
<div style="text-align:center"><strong>1 Voto</strong><br>
<p><input onchange="this.form.submit();" value="6019" id="6019" name="comment" type="radio"><label for="6019">Votar</label></p></div></div>
<p class="form-submit">
<input name="submit" id="votarcomentform" value="Votar" type="submit">
<input name="comment_post_ID" value="6183" id="comment_post_ID" type="hidden">
<input name="comment_parent" id="comment_parent" value="0" type="hidden">
</p>
<input id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment" value="f33d177e03" type="hidden"><script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>
</form>
正如你可以以看到这个版本,我试图用 onchange 事件提交它,但我也尝试了 JQuery:
<script>
jQuery(document).ready(function($) {
$('input[type="radio"][name="comment"]').click(function() {
$(this).closest("form").submit();
});
});
</script>
我做错什么了?