Avatar of arielbf
arielbf
Flag 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

jQueryMobile

Avatar of undefined
Last Comment
arielbf

8/22/2022 - Mon
Robert Schutt

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

arielbf

ASKER
I've try it and it is still not working...
Robert Schutt

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/
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
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
Robert Schutt

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
arielbf

ASKER
It is working now (-: