Для таких вещей я всегда использую EJS.
http://embeddedjs.com/
Снимите угловые скобки с вашего jQuery.
$( ".cancel" ).live( 'click', function() { $( this ).remove(); });
function reply( postId ) {
if ( $( "#reply" + postId ).size() == 0 ) {
var context = { postId: postId };
$( "#root" + postId ).after(new EJS({ url: '/template.ejs' }).render( context ));
}
}
Поместите их в шаблон со своими острыми маленькими друзьями.
<div id="reply<%= postId %>">
<textarea cols="70" rows="8" class="reply_editor"></textarea>
<br>
<span class="ok_cancel">
<input type="button" value="Submit">
<input type="button" value="Cancel" class="cancel">
</span>
</div>
Встроенные стили - дело рук дьявола.
.reply_editor {
margin-bottom: 10px
}
.ok_cancel {
margin-bottom: 30px;
}
Для большей разборчивости не прикрепляйте обработчики в своем HTML. Присоедините их, используя jQuery.