javascript - 如何通过 JQuery 修改样式属性?

标签 javascript html css

我有如下由 UI 框架生成的元素:

<div id="GENERATED_CONTAINER" style="position: fixed; z-index: 100; left: 368px; top: 52px; width: 545px; height: 846px;">
    <div id="GENERATED_CONTENT style="opacity: 0.1; left: 5px; top: 5px; bottom: -5px; width: 545px; height: 846px;">
    </div>
</div>

我需要编写一个脚本,从样式属性中删除 widthheight

var elems = $("[id^='GENERATED_']");
//what should I apply now?

最佳答案

简单写.css

$("[id^='GENERATED_']").css({
  width: 'inherit', //or the value
  height: 'inherit' //or the value
})

关于javascript - 如何通过 JQuery 修改样式属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29466686/

相关文章:

JavaScript getElementById().innerHTML=data.body.result 不断重复...如何修复?

javascript - 为什么我的按钮在我点击时不隐藏文本区域

javascript - 添加 keydown 事件监听器可阻止我通过在 chrome 中按 F-12 检查 HTML 元素

html - 在浏览器开发人员工具的“网络”标签下查看页面预览时,缺少CSS样式

html - CSS 伪类悬停属性

php - 使用css将div与不同的高度对齐

JavaScript ||运算符根据顺序给出不同的结果

html - 如何在 html/css/js/php 中格式化代码

html - 如何在 html 中设置页面缓存?

javascript - 可排序在模态中不起作用,但在启动模态的页面上起作用