0

I'm having issue, when jquery appending string instead of tags. Here is my code:

$('.nested_comments_'+<%= @comment.parent.id %>).append("<div class='<%= 'nested_comments nested_comments_'+ @comment.id.to_s%>'></div>")

ANd this results in

"<div class='nested_comments nested_comments_584'></div>" 

instead of html tag. WHat am i doing wrong?

4

1 回答 1

0

你确定你不只是想念最后的父母吗:

$('.nested_comments_'+<%= @comment.parent.id %>).append("<div class='<%= 'nested_comments nested_comments_'+ @comment.id.to_s%>'></div>");

您可以使用反转样式,使用appendTo

$("<div class='<%= 'nested_comments nested_comments_'+ @comment.id.to_s%>'></div>").appendTo('.nested_comments_'+<%= @comment.parent.id %>);
于 2013-02-28T12:53:23.660 回答