Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Jquery Mobile onSearch事件处理程序_Html_Jquery Mobile_Cordova - Fatal编程技术网

Html Jquery Mobile onSearch事件处理程序

Html Jquery Mobile onSearch事件处理程序,html,jquery-mobile,cordova,Html,Jquery Mobile,Cordova,我正在使用jquery mobile和phoneGap在android中创建一个应用程序 在HTML5标准中, 但是搜索事件没有被触发 是因为我用手机吗 有没有其他方法可以使用它?您可以绑定到更改事件,以确保在用户完成键入后捕获搜索字符串: $('input[type="search"]').on('change', function (event) { //the user has changed the value and de-focused the element or sub

我正在使用jquery mobile和phoneGap在android中创建一个应用程序

在HTML5标准中,

但是搜索事件没有被触发

是因为我用手机吗


有没有其他方法可以使用它?

您可以绑定到
更改
事件,以确保在用户完成键入后捕获搜索字符串:

$('input[type="search"]').on('change', function (event) {
    //the user has changed the value and de-focused the element or submitted the search
});​
下面是一个演示:


请注意,
.on()
从jQuery 1.7开始是新的,如果您使用的是较旧的版本,那么在本例中它与
.bind()

相同。坦率地说,我无法获得此代码和示例的用户行为。您在移动应用程序中有搜索字段。你可以在那里打一些东西。。如何启动这项活动?在PC上,我按了“回车”,但如何在移动应用程序中触发此事件?@RredCat当用户单击搜索框外时,
change
事件应触发。例如,如果他们单击“搜索”按钮,则应更改焦点元素并触发文本输入上的
change
事件。您还可以绑定到按钮的
单击事件。我知道了。但我在任何例子中都没有看到过漂亮的搜索按钮。所以对我来说,最好的方法是
afterkeyup
事件。