[英]PHP's JavaScript Modal
I'm having a problem with my java script.我的 java 脚本有问题。 The Modal works fine at first but whenever I click it on its second time there are 2 modals that appear, the previous and the new ones.模态起初工作正常,但每当我第二次单击它时,都会出现 2 个模态,前一个和新的。 it stacks every time I click the button.每次单击按钮时它都会堆叠。
Problem solved.问题解决了。
function appendHtml(el, str) {
var div = document.createElement('div');
div.innerHTML = str;
$el = el;
$(el).find(".modal");
if ($el.lenght){
var cnt = $(div.children[0]);
$(".modal").replaceWith(cnt);
} else {
el.appendChild(div.children[0]);
$el.lenght = 1;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.