onchange wont fire after programmatically changing html select dropdown

血红的双手。 提交于 2019-12-05 09:25:43

Select onchange doesn't fire for programattic changes, you need to fire it yourself with league.onchange();

As noted by @Greg, the call should be lowercase.

Additionally, I don't know if dojo has a trigger method, but in jQuery this would be done as jQuery('#league').trigger('change').

Depending on your version of dojo you may also want to check: http://dojotoolkit.org/reference-guide/1.8/dojo/connect.html

Have you tried just calling the select by it's id using normal js?

document.getElementById('league').onchange.call();
singpolyma

As others have said, you need to trigger the event yourself, just setting the value does not do that. See the code on How to trigger event in JavaScript? to see how in a cross-browser way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!