S
S
Sergey750il2015-10-27 23:33:12
JavaScript
Sergey750il, 2015-10-27 23:33:12

How to make such a selection?

Good day. The task was to select the first block with the .office_status class in the ofice block. I tried several options, but in all options there is a selection only in the first .office block

<div class="ofice data_103">
<div class="ofice_number"><div>Офис </div><strong>103</strong><hr></div><div>.............................</div>
<div class="ofice_status"><em>Типография ООО "КрафтПепер"</em></div>
<div class="ofice_status"><a href="http://xxxxx.ru/" target="_blank">xxxx.ru</a></div>
<div class="ofice_status">[email protected]</div>
<div class="ofice_status">8 (8882) 55-55-76</div>
<div class="are-us">
<div class="are">

<strong>Площадь</strong>
<div class="are-value">24 кв.м.</div>
</div>
</div>
<div class="price">
<div class="price-word">Цена</div>
<div class="price-value">5000р. кв.м.</div>
</div>
<a class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Подробнее</a>

</div>

<div class="ofice data_103">
<div class="ofice_number"><div>Офис </div><strong>103</strong><hr></div><div>.............................</div>
<div class="ofice_status"><em>Типография ООО "КрафтПепер"</em></div>
<div class="ofice_status"><a href="http://xxxxx.ru/" target="_blank">xxxx.ru</a></div>
<div class="ofice_status">[email protected]</div>
<div class="ofice_status">8 (8882) 55-55-76</div>
<div class="are-us">
<div class="are">

<strong>Площадь</strong>
<div class="are-value">24 кв.м.</div>
</div>
</div>
<div class="price">
<div class="price-word">Цена</div>
<div class="price-value">5000р. кв.м.</div>
</div>
<a class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Подробнее</a>

</div>
<div class="ofice data_103">
<div class="ofice_number"><div>Офис </div><strong>103</strong><hr></div><div>.............................</div>
<div class="ofice_status"><em>Типография ООО "КрафтПепер"</em></div>
<div class="ofice_status"><a href="http://xxxxx.ru/" target="_blank">xxxx.ru</a></div>
<div class="ofice_status">[email protected]</div>
<div class="ofice_status">8 (8882) 55-55-76</div>
<div class="are-us">
<div class="are">

<strong>Площадь</strong>
<div class="are-value">24 кв.м.</div>
</div>
</div>
<div class="price">
<div class="price-word">Цена</div>
<div class="price-value">5000р. кв.м.</div>
</div>
<a class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Подробнее</a>

</div>


Did it like this:

$('.ofice .ofice_status:eq(0)').each(function(){
    $(this).css('display','block');
    });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Sofronov, 2015-10-27
@maxsof

I think it should be something like this:

$('.ofice .ofice_status').each(function(){
    $(this).eq(0).css('display','block');
});

H
holfza, 2015-10-27
@holfza

$('.ofice').each(function(){
    $(this).find('.ofice_status:first').css('display','block');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question