jQuery:选择样式属性? [英] jQuery: select style attribute?

查看:78
本文介绍了jQuery:选择样式属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How to select with a specific style attribute?

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

我在尝试:

I'm trying:

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

但没有选择。

but nothing gets selected.

推荐答案

您的示例适用于我,至少在Chrome中,一旦我更正了缺失的错字在行尾。

Your example works for me, in Chrome at least, once I corrected the typo of the missing " at the end of the line.

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

看这个演示。

这篇关于jQuery:选择样式属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆