JqueryMobile "Go" button in iPad
I have a jqeuryMobile form which has a textbox and search button. How to make the search button to get activated on clicking the "return开发者_开发技巧" button on ipad/iphone.
As you know when we touch on textbox, ipad keyboard srolls up which has return button. I would like clicking on return button to activate the search button and perform the search.
It was pretty simple
Please add these code for jquery mobile in your header part
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
After then in your form, please add it in your form
<form id="my_form" data-ajax="false">
On the JS part add this :
$("#my_form").submit(function(){
$.mobile.pageLoading();
// WHAT YOUR YOU WANT DO ON AJAX
});
You can easily handle submission on return on iphone/ipad
I'm not sure if this is still relevant as it has been a while. The default "submit" action of the form is evoked when the "Go" or the "Return" button is clicked in iOS. So this means the "Go" button is same as hitting "Enter" in a browser or that of the document.forms['myForm'].submit()
More information on how to override this action at How can I prevent the Go button on iPad/iPhone from posting the form
精彩评论