我正努力讓下面的工作。我可以用2個ID使用:has
而不是三個。只有當它有一個disabling_div
的孫子時,我才能夠將CSS應用於span_element
。Jquery。查找身份證的ID
jQuery的
$("[id^=span_element]:has[id^=another_id]:has([id^=DisablingDiv])").css({ "cursor": "not-allowed" });
或
$("[id^=span_element].find([id^=DisablingDiv])").css({ "cursor": "not-allowed" });
HTML
<div id="span_element_1"> <!--apply style to this, only when DisablingDiv_1 is below-->
<div id="another_id">
<div id="DisablingDiv_1">
Content
</div>
</div>
</div>
爲什麼downvotes?問題是不正確的,他顯示了他已經嘗試過什麼,問題是什麼.... – Martijn
謝謝@Martijn –