Reputation: 105
I need to do the following: every comment have a reply button with a specific ID number, how can I append this ID to the form action link so that the code will change from
<form action="http://www.mywebsite.com/comments/add_comment/1/" method="post" accept-charset="utf-8" enctype="multipart/form-data">
to
<form action="http://www.mywebsite.com/comments/add_comment/1/TheID" method="post" accept-charset="utf-8" enctype="multipart/form-data">
and than focus on the textarea?
this is the code of the button:
<a href="javascript:void(0)" id="{$comment->ID}" class="profile_comment_reply_button">reply</a>
Upvotes: 0
Views: 2165
Reputation: 571
In 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
Upvotes: 1