点击按钮复制文本类容
<tree-select id="resDepartId_form" name="resDepartId" class='col-input noSolbarTree'ng-model="formDataMain.resDepartId" ztree-data="resOrgObjData"chk-style="radio" correlate="false" ng-readonly="operation == 'operDetail'" select-key="longName" ng-required='true'></tree-select>
<div class="btnCopy" id="suoshubumen" title="复制">
<i class="fa fa-copy"></i>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#btnCopy").click(function(){
//var valId = document.getElementById("resDepartId_form");
//var textCont = valId.getAttribute("value")
//var textValee = valId.select();
//console.log('文本信息:'+textValee)
//var text = document.getElementById("resDepartId_form");
//var textCont = text.getAttribute("value");
//console.log('valIdvalIdvalIdvalId:'+textCont)
//$('#resDepartId_form').val(textCont).select();
//document.execCommand('Copy');
// $.copy(textCont);
var text = document.getElementById("resDepartId_form");
var textCont = text.getAttribute("value");
console.log('valIdvalIdvalIdvalId:'+textCont)
var $temp = $('<input>');
$('body').append($temp);
$temp.val(textCont).select();
document.execCommand('copy');
$temp.remove();
alert('复制成功1!');
});
});
</script>