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.
精彩评论