怎么用了append以后css样式设置不了了

html-css015

怎么用了append以后css样式设置不了了,第1张

$("#dipai").append("<div class='c1' style=' border:1px #999 solidwidth:100height:150px margin-top:40pxmargin-left:1pxz-index:4font-size:11px'><img style='cursor:pointer' width=100height=150src='pkptp/1h.JPG' \/><\/div>")

$(".c1").click(function(){$(this).css("border","2px red solid")}).appendTo($this)

前后顺序....

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html,输入问题基础代码。

2、在index.html中的<script>标签中,输入js代码:$('body').append($('body').css('z-index'))。

3、浏览器运行index.html页面,此时成功打印出了z-index的值。

var showimg = "<div class=\"imgFocus\"><h6>单击关闭</h6><img src=\"" + imgSrc + "\" alt=\"" + imgAlt + "\" /></div>"

$(this).parent("p").css("position","relative").append(showimg)