开发者

how to change the object_id while adding row dynamically using jquery

how to change the object_id while adding row dynamically using jquery

eg:

<script type="text/javascript" charset="utf-8">
    $(document).ready(function(开发者_StackOverflow){
      $("#addPerson").click(function(){
        $("#user  tr:last ").after("<%= escape_javascript(render :partial => 'user_new', :locals =>{:user_new => User.new}) %>");
        return false;
      });
    });
</script>


How about using the attr like this:

$('div').attr('id', 'someid').appendTo($(body));

You can replace the div with your own dynamic element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜