There is a code
function addBr() { if ($(window).width()<=750) { $('.journal img').each(function () { if ($(this).not('br')) { $(this).after('<br>'); alert('<br> созданы'); } else { return false; } }) } else { $('.journal').each().remove('br'); } } $(window).load(addBr); $(window).resize(addBr); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="journal"> <p><span>1</span><img src="img/file1.png" alt=""> учебных журнала в месяц</p> </div> <div class="journal"> <p><span>2</span><img src="img/file2.png" alt=""> учебных журнала в месяц</p> </div> <div class="journal"> <p><span>3</span><img src="img/file3.png" alt=""> учебных журнала в месяц</p> </div> help me figure out why every time the window is resized,
are created again and again. and when you change the window large from 750px side
not deleted
<br>with less than 750? - MihailPw