问题
I struggled with this for a while, so figured I'd put the answer on here.
How can I have an invisible button on jQM?
回答1:
Create the button using this tag -
<input type="[yourchoice, mine was submit]" id="[yourchoice]" data-role="none" />
The crucial part is the data-role="none"
. This means jQM ignores it, so when you use $.hide()
, you're not left with a random empty blob of rendering on the screen.
回答2:
In my case I can't receive click event on submit by pressing the "go" button if input is hidden (if it is not hidden - it works). I workaround it using css: "width:1px; height: 1px; background: transparent; border: 0;". May be it helps someone too.
来源:https://stackoverflow.com/questions/11174159/is-it-too-much-to-ask-to-have-an-invisible-button-on-jquery-mobile