javascript - jQuery:选择样式属性?

标签 javascript jquery html

如何选择具有特定样式属性的?

<div style="width: 420px; text-align: left; margin-top: 10px; margin-bottom: 10px;">

我正在尝试:

$("div[style='width: 420px; text-align: left; margin-top: 10px; margin-bottom: 10px;']);  

但是什么都没有被选中。

最佳答案

您的示例对我有用,至少在 Chrome 中,一旦我更正了行尾缺少的 "的拼写错误。

$("div[style='width: 420px; text-align: left; margin-top: 10px; margin-bottom: 10px;']");

See this demo.

关于javascript - jQuery:选择样式属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4291605/

相关文章:

javascript - 从正则表达式中排除 '+' 和 '&' 个字符

javascript - Meteor框架中的全局对象UI是什么以及如何使用它?

javascript - javascript变量是如何引用的?

jquery - 如何在 iPhone 上查看背景图片?

javascript - 无法计算总计以及在 html 中的表中添加/删除行

php - 点击链接后 JQuery 提交表单

javascript - 获取没有子元素的元素的内容

javascript - 使用 Cookie 防止用户点击链接两次

javascript - 如何在自定义所见即所得编辑器中添加 'TAB' 功能?

表单嵌套在表中时的 jQuery 表单提交