gpt4 book ai didi

jquery - 在 jQuery 中调用带有两个类的 div

转载 作者:太空宇宙 更新时间:2023-11-03 20:02:27 25 4
gpt4 key购买 nike

我有一个包含两个类的 div:

<div class="content pager" style="width: 1156px; float: left; list-style: none outside none;"></div>

我想用 jQuery 改变元素样式:

$(".content pager").width(0);  //Change the element style width 

但它不起作用。有什么问题吗?

最佳答案

试试这个:

$(".content.pager").width(0);

检查 jQuery's Class Selector .

width(0) 不会隐藏其内容。您需要隐藏它。而不是 width(0)。所以,你可以试试这个:

$(".content.pager").hide(0); // Will hide the div and free its space.
$(".content.pager").css('visibility', 'hidden'); // Will hide the div and take space belongs to it.

关于jquery - 在 jQuery 中调用带有两个类的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10742737/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com