I have several divs that have a common class. If one of these divs has a non- child div, I want to hide the div. I can find the correct div, but I cannot hide it.
This is my code,
$(function() { if ($(".adRight.childen('div')").length == 0) { $(this).hide(); } });
What should i use instead? this applies to the document, not the div found by the if-statement.
You are looking for:
$("div.adRight:not(:has(div))").hide();
How does he read.
(, .childen ), , , jQuery. ., if -, jQuery ( ). jQuery - , 0. 0 ., , hide, - hide , .
.childen
if
hide
:
if ($ ( ". adRight div" ) == undefined) { $ ( "AdRight." ) (). }
(~~ )
Source: https://habr.com/ru/post/1736083/More articles:Can I use XText for DSL using an XML file type? - javahow to implement k-tool for simple grouping in java - javaКак настроить репликацию? - Эта база данных не включена для публикации - sql-serverXML Schema Solution - xmlКакая связь между Программой Intel Atom Developer и операционной системой MeeGo? - intel-atomSelenium RC error while running tests - seleniumdual card implementation? - c ++DateTime.TryParse () error in Windows 7 - c #Getting my webapp for agnostic database with Hibernate - ormDeploy WS Addressing in the C # DotNet Web Service - c #All Articles