I’m trying to load some jquery javascript when my page is loaded, but it’s always loaded twice. I’m using jquery 1.7.2 and jquery mobile 1.1.0. I tried this 3 different methods, but it’s always loading the script twice.
$(document).bind("ready", function() { }
$(document).ready(function() { }
$(document).live('pageinit',function(event) { }
Edit: i solved it, shit ! i’m 100% sure this mistake will happen to nobody else, i’m sorry for this stupid problem.
Update: I tried this locally with jQuery 1.7.2 and jQuery Mobile 1.1.0 and it works fine. I’m seeing one 1 call to the
pageinitevent. I even tried multiple pages and still see only one call topageinit.You generally don’t want to use the ready event with jQuery Mobile, but stick to just the
pageinitevent. As per the jQuery mobile events documentation…For a more specific answer, you really need to post actual code; however, with your mixing of
readyandpageinitin your question, I am guessingpageinitandreadyare both calling the same code.