思路:先找到控件,然后设置它的html为空,即:$('#code').html("");
代码
<div id="code"></div>
function createCode (ele) {
//先清空上一次生成的二维码
$('#code').html('')
$("#" + ele).qrcode({
width: 40, //宽度
height: 40, //高度
background: "#ffffff", //背景颜色
foreground: "#000000", //前景颜色
text: toUtf8('http://containercode.com/pages/home/home')
});
}