添加按钮 复制文本
1.引入js
ZeroClipboard.min.js
2、Html
<div class="input-group"><input type="text" class="form-control link-area"/>
<span class="input-group-btn">
<button id="copy-button" type="button" class="btn btn-primary">复制</button>
</span>
</div>
3、Js
var clip = new ZeroClipboard($("#copy-button"));
clip.on('ready', function(event) {
clip.on( 'copy', function(event) {
event.clipboardData.setData('text/plain', $(".link-area").val());
});
} );