Tell me how to implement the update of the <div> block. I found the usual update without rebooting the block, but now the question is when text is selected in the block where any text (updateable) text selection disappears, as the block is not in place but is updated. But there are many sites where there is an update of the block without reloading the page and when selecting this block, any text in it, the selection does not disappear. How it's done ?

My code is:

 <div id="content"></div> function show() { $.ajax({ url: "time.php", cache: false, success: function(html){ $("#content").html(html); } }); } $(document).ready(function(){ show(); setInterval('show()',1000); }); 
  • one
    "But there are a lot of sites, ... a block without rebooting ... the selection ... does not disappear" - for example? As a simple solution, you can suggest checking for identical content with the incoming html before overwriting the contents of the block. - nörbörnën
  • one
    I think at “many sites” blocks are added, not rewritten - zb '
  • 2
    Something like if ($ ("# content"). Html ()! = Html) {$ ("# content"). Html (html)}, with an eye to the fact that these two pieces of text will need to be brushed to general view, as there may be differences in the number of spaces / hyphenations, etc. And yet, you absolutely wrongly applied the word "deign". - nörbörnën
  • 3
    Please explain how. - nörbörnën
  • 2
    @ malina95 woooo ... but did you notice that I'm not a topstarter? - nörbörnën

0