<span class="grandparent">
<span class='parent'>
<span id="popUP" class="child1">
Some content for popUP
</span> <!-- 1st child has width of 390px-->
</span>
</span>
现在,对于不同的选项,请说明子标记被新标记替换,如下所述。
option A) <span id="popUP" class="child2"></span>
<!-- 2nd child has popUP width of 550px-->
option B) <span id="popUP" class="child3"></span>
<!-- 3rd child has popUP width of 450px-->
option C) <span id="popUP" class="child4"></span>
<!-- 4th child has popUP width of 350px-->
如何使用JavaScript或jQuery动态更改弹出窗口的宽度?我尝试使用.find()
方法,但没有运气
答案 0 :(得分:0)
你不应该这样做吗?你的身份和班级反之亦然。
option A) <span class="popUP" id="child2"></span>
<!-- 2nd child has popUP width of 550px-->
option B) <span class="popUP" id="child3"></span>
<!-- 3rd child has popUP width of 450px-->
option C) <span class="popUP" id="child4"></span>
<!-- 4th child has popUP width of 350px-->
然后做这样的事情?
$("#child2").addClass("width2");
然后是css
.width2
{
width:550px;
}
考虑使用div。我在某处读取了忽略标签的内容。并张贴整个代码可能有所帮助。