There is a function with .append inside. It is called upon the .ready document and its .resize . As a result, .append works twice. Is it possible to somehow avoid this? Important: the function call when the page is loaded and its resize should remain.

 function example() { var targetBLock = $('.content'); targetBLock.append(' <span class="additional">additional content</span>'); } example(); $(window).resize(example()); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="content">Some content</div> 

    1 answer 1

    it is necessary so

     $(window).resize(example); 

    because example() is a function call