Reputation: 3458
I've been testing a website on mobile devices which uses a simple hide() / show() on a form. Works great on the desktop but not at all on mobile devices. Does anyone know if the functions are supported?
Using jQuery 1.5
Thanks
Ric
Upvotes: 0
Views: 3543
Reputation: 3458
Okay, this is a terrible answer and thanks to everyone for their help.
In the end I combined all the JS files together. This fixed the script execution order problem on iPhone / Android. I'm not sure why it was happening on this particular site, and only on mobile phones.
It's not a very elegant solution and I do not recommend it. In my case it was for a temporary microsite so decided it was acceptable. Should I discover more about the problem I will post it here.
As Colt pointed out I was a bit rash saying it wasn't en elegant solution combining all the files together. In fact it is just what you should be doing! My frustration was that desktop and mobile browsers handled the JS different, and when developing the site I don't combine/minify the files until I know they work. Makes debugging and updating libraries easier.
As I feel bad for suggesting poor advice here's a little top tip: When on the production server I use Smart Optimizer (http://farhadi.ir/works/smartoptimizer) to handle joining, minifying, GZipping and caching the files for me. Means my dev code remains nicely seperated and it's easy to up jQuery, plugins etc but on the live site everything is nicely stuck together.
Upvotes: -1
Reputation: 771
Ric I wouldn't say that combining all of the JS files together is really that bad of a solution, in fact I think that minifying and combining JS code is a great practice, unless you need people to be able to read your JS from source for some reason. Glad you got it fixed.
Upvotes: 0
Reputation: 8804
yes works fine, I had done in many projects for smartphones (iPhone, Android) specially and works as charm
you can be sure for this, because, new mobile web framework, jQtouch, and jQuery mobile is in jQuery and alot others too.
Upvotes: 1