我一直无法弄清楚如何手动触发 DOM 事件。
例如,这里是我尝试为 li 触发“click”事件
Ext.DomQuery.select('#mapRoutesPanel ol li:nth-child('+(index+1)+')')[0].click();
它在 google chrome 上运行良好,但是当我构建同一应用程序的 android native 应用程序时,它给了我错误
Uncaught TypeError: Object #<HTMLLIElement> has no method 'click'
最佳答案
Ext JS 提供了在 DOM 树中搜索元素的方法。
Look Sencha Fiddle - its sencha touch app, i tested it on my android(opera) and iphone(safari) its work for me
像这样的东西:
var liElement = Ext.get('mapRoutesPanel').down('ol li:nth-child(' + (index + 1) + ')');
关于extjs - Sencha : How to trigger click event on li element,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16983415/