why does the test message shows twice on:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<script type="text/javascript">
alert("Test");
</script>
</body>
</html>
I copied the headers from from http://jquerymobile.com/demos/1.2.0/docs/about/getting-started.html and as I started doing some examples I noticed that my javascript methods where being called twice.
Here is the code in JsFiddle:
As Explosion Pills perfectly stated you have to play by jQM rules. At least:
pageinitevent instead of jQuery ready handler.So instead of
use
jsFiddle is here