I'd like to insert variables to an snippet of html text like
<form action="#" method="post"> <textarea class="form-control" name="comment" id="editComment25"></textarea > <br> <button class="btn btn-primary" id="commentBtnID25">Save Edits</button > <a href="#">cancel</a> </form > I tried with an clumsy solution:
var comment_id = $(e.target).attr("id") var editCommentID = "editComment" + comment_id var commentBtnID = "commentBtnID" + comment_id var commentEditForm = '<form action = "#" method = "post"><textarea class="form-control" name ="comment" ' commentEditForm += 'id="' + editCommentID + '"></textarea > <br>'; commentEditForm += '<button class="btn btn-primary" id="' + commentBtnID + '">Save Edits</button > <a href="#">cancel</a></form >' Is interpolation possible here as it does in python?
commentEditForm = """" <form action="#" method="post"> <textarea class="form-control" name="comment" id="%s"></textarea > <br> <button class="btn btn-primary" id="%s">Save Edits</button > <a href="#">cancel</a> </form > """ %(editCommentID, commentBtnID)