javascript - On div refresh text inside the input box shouldn't clear -


i have div , refreshes every 3 seconds. inside div there input box , whatever type gets cleared out in 3 seconds. there way text remain inside input box , not cleared out?

index.js

<div id="show_here"></div> <script type ="text/javascript">     $(document).ready(function() {         setinterval(function() {             $('#show_here').load('fetch.php')         }, 3000);     }); </script> 

fetch.php

<div>      // code here      <input type="text" id="input" /> </div> 

input box needs inside page since inside while loop. can done or need change whole code make work?

preserve , set

setinterval(function() {     my_val = $('#input').val();     $('#show_here').load('fetch.php');     $('#input').val(my_val);  }, 3000); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -