$(".mui-btn-block").click(function(){
$(".sl").val( $(".sl").val());//这里可以获取动态数据赋值给$("#hide").val()
$(".sl").select();
try {var state = document.execCommand("copy");}
catch(err){var state = false;}
if(state){
alert("复制成功")
}else{
alert("复制失败")
}
})
<input type="text" readonly="readonly" class="sl" style="color:#666666" placeholder="连接" value="http://www.baidu.com/index.php?pdid=adwadasdasdjasdasdasdasasasSASASDF5S5DFV4SD1">
<button type="button" class="mui-btn mui-btn-primary mui-btn-block" style="margin:0 auto;background:#2571ff;border:1px solid #2571ff">点击复制邀请连接</button>