javascript - 强制 !important 类与 js-jquery

标签 javascript php jquery css maps

我有一个带有谷歌自定义搜索的页面,我有一个 div 类,我想将宽度更改为 100%,不,我试图设置

.gs-webResult {width:100%!important;}

我也试过:

<script>$('.gs-webResult').width('100%');</script>

但没有改变,当重新加载页面时仍保留之前的设置我如何强制类使其变为宽度:100%,使用 css 或 js 或其他方法?

注意:如果使用“stylebot”工具进行 chrome 工作

但是当在 css 中插入 .gs-webResult {width:100%!important;} 并重新加载页面时不会改变。

最佳答案

试试这个:

$('.gs-webResult').css('width', '100% !important');

编辑: 这听起来有点像你希望即使重新加载页面也能保留它,如果是这样,那么你必须在每次加载页面时进行此更改,在:

$(function() { });

关于javascript - 强制 !important 类与 js-jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31183445/

相关文章:

javascript - jQuery $(window).height 动态添加内容错误

javascript - 使用 jquery 拖放图像

php - Google Docs 文档选择器?

javascript - Node.js:确定修改后的文件大小

php - 从表中请求数据并以 html 形式显示

javascript - Codeigniter jquery 在 AJAX 文件上传中不起作用

jquery every() 仅循环访问 ASP.NET gridview 一次

javascript - 加载带有嵌入 javascript 文件的本地 HTML 页面 DotNetBrowser

javascript - html5+js : resolution or size of &lt;input type=file capture=camera>

php - 如何将 MySQL 数据库中的日期偏移 1 秒?