I have this problem. I am trying to make a button "click it self" using a setTimeout function in javascript. I need this small piece of code to function to be able to simulate a refresh. The problem is, because the button on which I'm calling the refresh is within a form tag, this operation only occurs once, instead of continuously repeating itself. Here is my javascript
<script language="javascript" type="text/javascript">
function ClickMe(){
setInterval('document.getElementById("auto").click()',5000);
alert("Function works");
}
</script>
Here is the element on which I am calling it.
<form>
<input id="auto" type="submit" value="Click" onClick="ClickMe()" />
</form>
If you remove the "<form></form>
" tag, the code runs normally by calling itself again and again every 5 seconds. Byt once you add the "<form>
" tag, the function is only called once. If someone could help me out, I'll be really grateful. Thanks