S
S
Stacy None2018-03-18 11:40:04
JavaScript
Stacy None, 2018-03-18 11:40:04

How to display text if content is empty?

There is a block

<ul class="list">

</ul>

If there is no content (list) in the block, then you need to display the List is empty
. And when there is content in the ul block, this text is hidden.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
coderisimo, 2018-03-18
@Stacy11

https://codepen.io/coderisimo/pen/yKVLmE
remove items from the list to make the caption appear.

A
Arthur, 2018-03-18
@ART_CORP

Good afternoon.
Alternatively https://codepen.io/Art_Corp/pen/MVbWZX

R
retyui, 2018-03-18
@retyui

if(document.querySelector('.list').children.length === 0){
    alert('список пуст!');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question