0

我需要执行以下操作:每个评论都有一个带有特定 ID 号的回复按钮,我如何将此 ID 附加到表单操作链接,以便代码将从

<form action="http://www.mywebsite.com/comments/add_comment/1/" method="post" accept-charset="utf-8" enctype="multipart/form-data">

<form action="http://www.mywebsite.com/comments/add_comment/1/TheID" method="post" accept-charset="utf-8" enctype="multipart/form-data">

而不是专注于文本区域?

这是按钮的代码:

<a href="javascript:void(0)" id="{$comment->ID}" class="profile_comment_reply_button">reply</a>
4

1 回答 1

1

在 JQuery 中:

var id = yourid;
var action = $("getyourform").attr("action"); //action without id
$("getyourform").attr("action",action+id); //add id to action
$("getyourform").children(input).focus(); //focus your input field
于 2012-05-14T18:57:53.130 回答