Javascript .html不';我不上样式表课
我搜索过网络,也许我问错了或者搜索错了方向,但是我似乎找不到解决这个问题的方法 当我执行.html()或.append()时,我似乎没有将样式表样式放入新的html中 以下是我正在做的:Javascript .html不';我不上样式表课,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我搜索过网络,也许我问错了或者搜索错了方向,但是我似乎找不到解决这个问题的方法 当我执行.html()或.append()时,我似乎没有将样式表样式放入新的html中 以下是我正在做的: $.post( "updatepassword.php", { new_pass: true, password1: $(form).find('#password1').val(), password2: $(
$.post( "updatepassword.php", {
new_pass: true,
password1: $(form).find('#password1').val(),
password2: $(form).find('#password2').val() }).done(function( data ) {
if(data == "success"){
show_loading_bar({
delay: .5,
pct: 100,
finish: function(){
$(".modal-header").append('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>');
$(".modal-body").html("Yes...");
$(".modal-footer").html('<button type="button" class="btn btn-white" data-dismiss="modal">Luk</button>');
}
});
} else {
toastr.error("Error!", opts);
$(form).find('#password1').select();
}
});
$.post(“updatepassword.php”),{
新帕斯:没错,
password1:$(form).find('#password1').val(),
password2:$(表单).find('#password2').val()}).done(函数(数据){
如果(数据=“成功”){
显示加载条({
延迟:.5,
百分之一百,
完成:函数(){
$(“.modal header”).append(“×;”);
$(“.modal body”).html(“是…”);
$(“.modal footer”).html('Luk');
}
});
}否则{
toastr.error(“error!”,opts);
$(表单)。查找('#password1')。选择();
}
});
所有的类都没有加入新的html?!?这是一个错误还是我遗漏了什么
希望提前得到帮助和感谢:-)解决此问题的更好方法(更易于维护!)可能是将这些元素作为HTML的一部分输出,然后切换它们的可见性(通过取消类设置或使用$.show/$.hide) 请参见此示例: html: js:
在所示示例中没有样式表样式。你是说你的课程没有增加吗?是的,课程没有增加。样式表已经加载到我的页面中。这几行代码本身可以正常工作:看起来没有调用
finish:
事件。不,正在调用finish事件,我确实将元素放入html中,但只是没有使用类。这没有意义。因为代码是正确的(正如JSFIDLE所示),所以肯定有其他东西干扰了类
<div class="modal-header">
<button type="button" class="close hidden" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body hidden">
Yes...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white hidden" data-dismiss="modal">Luk</button>
</div>
.hidden {
display: none;
}
$(function () {
$('.hidden').removeClass('hidden');
});