Home  >  Article  >  Web Front-end  >  用js拼接的html ,里面的class属性失效,帮忙看看应该如何拼接!_html/css_WEB-ITnose

用js拼接的html ,里面的class属性失效,帮忙看看应该如何拼接!_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 08:53:382553browse

                  var strhtml = ''; 
strhtml +='

';
strhtml +=' ';
strhtml +='';
strhtml +=' ';
strhtml +='
';
strhtml +='
';
$("#add").after(strhtml);


回复讨论(解决方案)

var strhtml = " 

"
                        + "  "
                        + " "
                        + " "
                        + " 
";
            $("#add").append(strhtml);

easyUI用js拼接的话要有效需要"唤醒",试试在append后加上
 $.parser.parse($("#add"));

after是添加在当前元素外部后面 append是添加在当前元素内部后面

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn