本文介绍了什么的JavaScript将模拟从谷歌地图API的3个名额自动完成下拉菜单选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想自动化项目(使用jQuery)从谷歌地图API V3地方库的自动完成下拉菜单的选择。 我无法确定,从下拉列表中选择该项目所需的JavaScript
I'm trying to automate the selection of items (using jQuery) from the autocomplete dropdown of the google maps api v3 places library. I am unable to determine the javascript required to select the item from the dropdown.
因此,例如,这里有完成的局部场,并触发下拉为类似此资源的谷歌的演示:
So, for example, here are the steps required to complete a partial field and trigger the dropdown for something like google's demo of this resource:
$('input[name=address]').val("525 Bergen Street");
$('input[name=address]').trigger("focus");
$('input[name=address]').simulate("keydown", { keyCode: $.ui.keyCode.DOWN });
$('input[name=address]').simulate("keydown", { keyCode: $.ui.keyCode.ENTER });
任何建议将是极大的AP preciated,谢谢。
Any suggestions would be greatly appreciated, thanks,
里尔
推荐答案
尝试使用的:
$(elem).simulate(mouse_or_keyboard_event_type, options);
支持的事件类型:
Supported event types:
- 小鼠为鼠标悬停,鼠标移开,鼠标按下,鼠标松开,鼠标移动,点击,DBLCLICK
- 键盘: KEYUP,KEYDOWN,关键preSS
- mouse: mouseover, mouseout, mousedown, mouseup, mousemove, click, dblclick
- keyboard: keyup, keydown, keypress
这篇关于什么的JavaScript将模拟从谷歌地图API的3个名额自动完成下拉菜单选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!