There are divs on the page with .item, inside them there are 2 divas, .news-text-area and .news-img-area, like using jqery, if in one or more .item blocks, div .news-img-area is not empty , add padding to the .news-text-area which is next to it in the .item block?

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants HamSter , Sergey Gornostaev , cheops , aleksandr barakin , Dmitriy Simushev Sep 20 '16 at 14:46 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    ... value = 999; $(".news-img-area").each(function(){ var size = $(this).text().length; if (size > 0){ var targetElement = $(this).parent().children(".news-text-area"); if (targetElement !== undefined) { targetElement.css( "padding", value); } } }); ...