开发者

how to change the object_id while adding row dynamically using jquery

开发者 https://www.devze.com 2023-01-10 02:42 出处:网络
how to change the object_idwhile adding row dynamically using jquery eg: <script type=\"text/javascript\" charset=\"utf-8\">

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

精彩评论

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