Eamorr
Eamorr

Reputation: 10012

jQuery Mobile: can't enter a space in input

Greetings,

I have the following jQuery mobile page:

Everything works fine, except I can't press space to enter a space! It just ignores my spacebar.

Any ideas?

Many thanks in advance,

Upvotes: 1

Views: 531

Answers (1)

jptsetung
jptsetung

Reputation: 9156

I had a similar problem. In certain situations (in lists for example), jquery mobile grabs the space bar key (and the enter key) to trigger navigation actions.

If you have an input text in a list, then you won't get the space and enter events.

My solution is dirty but it works. Before calling initializePage, change the code of the SPACE bar in jquerymobile internals. The consequence is that you won't get the navigation actions with the spacebar but you still have them with the enter key.

$.mobile.keyCode.SPACE=13; //to avoid spacebar problem, make jquerymobile think that the sapcebar code is 13 (enter)
$.mobile.initializePage();

Upvotes: 1

Related Questions