jQuery append

<script> //option 1 - jQuery jQuery(document).ready(function(){ var the_code = `<a href="#">the link</a>`; jQuery('#the-block').append( jQuery('<a href="#">the link</a>')); jQuery('#the-block').after(the_code); }); //option 2 - replace innerHTML var the_interval = 0 ; var existBlockCondition = setInterval(function() { if (jQuery('.the-block .the-content').length) { clearInterval(existBlockCondition); replaceBlock(); } else{ the_interval++; if (the_interval>3){clearInterval(existBlockCondition);} } }, 1500); // check every 1500ms function replaceBlock(){ document.querySelector(".the-block .the-content").innerHTML = `<h1>Hello</h1>`; } </script>

Posted 06/09/2023 in Javascript , JQuery , Target by Denis Tags:

Posted 06/09/2023 in Javascript , JQuery , Target by Denis

Posted 06/09/2023 in Javascript , JQuery , Target

Recommended articles