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