Reputation: 63
I've attached files on bottom of the page (before body):
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="/js/mobile.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
in mobile.js is code like that:
$(document).ready(function(){
console.log('test')
});
and firebug returns me 'test' twice, why?
Upvotes: 1
Views: 621
Reputation: 8472
It is recommended to use the pageInit
event with jQuery mobile as opposed to $(document).ready
. See this page for more details: jQuery Mobile Docs - Events.
The code you could use:
$("#yourPage").live('pageinit', function() {
console.log('test');
});
That may fix your problem.
Upvotes: 3