Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Beta release - cannot run javascript using onclick?? #1887

stopsusa opened this Issue · 14 comments

7 participants

stopsusa Forrest Zeisler Adrian Adkison samspot Todd Parker Kin Blas praveen10

My Profile

Worked without a problem in last alpha release

Please advise

Thanks - Any and all help appreciated

Forrest Zeisler

This has broken a significant amount of my code. I'm replacing them all with a binding to the "vclick" event, but I'm not happy about this change.

Adrian Adkison

@forrest Agreed, I just changed all bindings to vclick and now my test Android (2.3) ajax navigation is broken. The vclick event is not being caught and the page is being requested as normal. Changing back to using click for everything. Let you know how it all goes.

Adrian Adkison

I am finding a few problems in Android ajax navigation in 2.3 as of the Beta release. In order for ajax navigation to work consistently and to be able to use 'click' events you have to set $.mobile.useFastClick = false. Also look out for this guy, #1904.


Please see this thread for more info:

I'm personally finding that for links it only fails on iphones, and only when href='#'. However I did notice that onclick wasn't working for divs.

Kin Blas jblas was assigned
Todd Parker

You can turn off $.mobile.useFastClick and your click events will work again, but there will be a delay on iOS and other touchscreen devices. Ideally, you'd switch to using vclick in your code to speed up the responsiveness.

Todd Parker

BTW - you need to use latest instead of beta 1 if you want to disable this feature.


I can confirm that turning off $.mobile.useFastClick does not affect this issue in beta1.

Todd Parker

Did you try latest? There was an issue in beta 1 that made turning this off not work.

Kin Blas


How and when are you turning off $.mobile.useFastClick? There was a bug where toggling that option didn't do what it advertised. This is why Todd said you need to try the latest.


No, I haven't tried it yet, and we're overbudget on our jquery mobile upgrade task, so we cannot afford to upgrade again at this time :(

The workaround we found is working well enough for now:
a href="javascript:void(0);" onclick="alert('goodbye');">Goodbye</a

This works on all the devices we tested and doesn't require us to refactor existing javascript.

Edit: Had to deform the a tag to keep markdown from making it an actual link

Todd Parker

This is now fixed in master.

Todd Parker toddparker closed this

Just replace href="#" with href="javascript:" , this will trigger the OnClick code.

  • Praveen
Todd Parker

using href="javascript:" isn't a recommended approach for a number of reasons, but it is especially bad because it breaks the PE approach.


Jqm beta2 is stable ... switch to beta2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.