.container可以包含许多.components,而.components本身可以包含.containers(反过来可以包含.components等).
给出这样的代码:
$(".container .component").each(function(){
$(".container", this).css('border', '1px solid #f00');
});
Run Code Online (Sandbox Code Playgroud)
我需要添加到大括号内的行,以便只选择CSS中宽度设置为"auto"的嵌套.container?我确信它很简单,但我还没有真正使用过jQuery.
我需要根据特定css属性找到一个元素.在css被内联应用,我不能使用的类.反正有没有实现这个目标jQuery?
如何选择具有特定样式属性?
<div style="width: 420px; text-align: left; margin-top: 10px; margin-bottom: 10px;">
Run Code Online (Sandbox Code Playgroud)
我尝试着:
$("div[style='width: 420px; text-align: left; margin-top: 10px; margin-bottom: 10px;']);
Run Code Online (Sandbox Code Playgroud)
但没有任何东西被选中