Link to home
Start Free TrialLog in
Avatar of arielbf
arielbfFlag for Israel

asked on

show submit button after delay with jquery mobile

I'm trying to delay the appearance of the submit button....
here is my code:

<!DOCTYPE html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>

<body>

<div data-role="page">
	<div data-role="content">
		<fieldset>
			<form>
		
				<input type="submit" data-theme="b" value="continue" id="submitButton" name="continue">
			
			</form>
		</fieldset>
	</div>
</div>

<script>
$(document).ready(function(){
    function hidesubmit(){
	  $("#submitButton").hide();
	}
	function showsubmit(){
	  $("#submitButton").show();
	}
});
setTimeout(hidesubmit, 0);
setTimeout(showsubmit, 2000);
</script>


</body>
</html>

Open in new window

Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Either put the setTimeout calls inside the document.ready()  function or put the function definitions outside it. In this case, looking at the placement of the code, I think you can just use:
<script>
    function hidesubmit(){
	  $("#submitButton").hide();
	}
	function showsubmit(){
	  $("#submitButton").show();
	}
setTimeout(hidesubmit, 0);
setTimeout(showsubmit, 2000);
</script>

Open in new window

Avatar of arielbf

ASKER

I've try it and it is still not working...
Can you be a bit more specific? I've put it in a jsFiddle and it works without a problem so maybe there is something else influencing your code or html page?

see: http://jsfiddle.net/robert_schutt/7wefn6wg/
Avatar of arielbf

ASKER

I've checked the jsFiddle and it is working. For some reason it is not working when I test my page. Here it is...
delay1.html
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arielbf

ASKER

It is working now (-: