How can i Set & Auto Refresh the value of a input field with javascript ?
i am currently using like this .
<script type="text/javascript">
var auto_refresh = setInterval(
function()
{
$('#value5').fadeOut("fast").load('get_data.php').fadeIn("slow");
}, 5000);
</script>
<div id="value5" ></div>
this is working fine if i set id=value5 in div but if i set the same id for input box like this
<script type="text/javascript">
var auto_refresh = setInterval(
function()
{
$('#value5').fadeOut("fast").load('get_data.php').fadeIn("slow");
}, 5000);
</script>
<input class="form-control input-lg" id="value5" type="text">
then its not showing data in the input box.
i even tried this code from Set the value of an input field
<input type="text" id="value5">
<script type="text/javascript">
var elem = document.getElementById("value5");
elem.value = "My default value";
</script>
but this shows "My default value" as value and its one time only, its not refreshing. i even tried modifying the above code like this
<input type="text" id="value5">
<script type="text/javascript">
var elem = document.getElementById("value5");
elem.value = "#value5";
</script>
still not working.