views:

54

answers:

1

how to change the object_id while adding row dynamically using jquery

eg:

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

How about using the attr like this:

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

You can replace the div with your own dynamic element.

Mike Johnson