"; } } return ldgcopystr; } $(function() { InitCopy(); // Event delegation would be better than multiple .each() calls $(document).on('click', '.copy1', function() { var id = $(this).closest('[id]').attr('id'); var copystr = GetCopyStr(id, 1); CopyText(copystr); }); $(document).on('click', '.copy2', function() { var id = $(this).closest('[id]').attr('id'); var copystr = GetCopyStr(id, 2); CopyText(copystr); }); $(document).on('click', '.copy3', function() { var id = $(this).closest('[id]').attr('id'); var copystr = GetCopyStr(id, 3); CopyText(copystr); }); });
统计代码