ウェブサイトの返信フォームのsumbitで関数を実行しようとしています。これらのフォームはページの読み込み後にJavascriptによって作成されるため、Jqueryはライブ関数を使用して「.replyformsubmit」クラスのボタンのクリックに反応します。
フォームの入力値を記録するスクリプトが必要ですが、記録できないようです。
現在、ボタンを格納しているフォームのIDが見つかりましたが、それを使用して入力値を見つけようとしても無駄に思えます。おそらく男子生徒のエラーですが、私はそれを推測できないようです。
どんな助けでも素晴らしいでしょう。
Jquery:
$(".replyformsubmit").live("click", function(){
var curform = $(this).closest('form').attr('id');//what form is the current one?
var comment = $('#' + curform + ' > input[name=comment]"').val(); //comes out as undefined
var replyingSerial = $('#' + curform + ' > input[name=replyingSerial]"').val(); //comes out as undefined
...
スクリプトは、コメントとreplyingSerialが何であるかを見つけることができないようです。
標準のサンプルフォームのHTMLは次のとおりです。
<form action="com.php" method="post" id="replyform_quickreply_1345291318.6107" class="replyform">
<textarea name="comment" type="text" id="commenttextquickreply_1345291318.6107">
</textarea>
<br>
<input type="submit" value="send!" class="replyformsubmit">
<input type="hidden" style="visibilty: hidden;" name="replyingSerial" value="1345291318.6107"></form>