Chinaunix

标题: jquery 查找select ,并触发事件. [打印本页]

作者: 听老歌    时间: 2011-03-30 20:52
标题: jquery 查找select ,并触发事件.
转:yond

jquery 查找select ,并触发事件.



项目中,用jquery 查找select ,并触发事件. 记一笔.关键代码;

  1.                              var count=$("#drpCity option").length;
  2.                              //查找城市
  3.                               for(var i=0;i<count;i++){  
  4.                                     var vTmp=$("#drpCity").get(0).options[i].value;
  5.                                     if($.trim(vTmp)==vDpoizone){  
  6.                                          $("#drpCity").get(0).options[i].selected = true;  
  7.                                          $("#drpCity").trigger("change");
  8.                                               break;  
  9.                                          }  
  10.                                     }
  11.                               
  12.                                     
  13.                                }
复制代码





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2