下拉菜单触发更改事件 [英] Trigger change event of dropdown
本文介绍了下拉菜单触发更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要触发下拉列表中的$(document)的变化情况。就绪使用jQuery。
I want to trigger the change event of dropdown in $(document).ready using jquery.
我在用户详细信息页面国家和状态的级联下拉菜单。我怎样才能设置的值(这是从DB采取基于用户ID)为国家和国家的MVC使用C#。
I have a cascading dropdown for country and state in user details page. how can i set the value (which is taken from DB based on the user id) for country and state in MVC with C#.
推荐答案
我不知道这么多的JQuery,但我听说它可以让火原生事件与此语法。
I don't know that much JQuery but I've heard it allows to fire native events with this syntax.
$(document).ready(function(){
$('#countrylist').change(function(e){
// Your event handler
});
// And now fire change event when the DOM is ready
$('#countrylist').trigger('change');
});
的更多信息这里。
这篇关于下拉菜单触发更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文