options [Text]为null或不是javascript中的对象

时间:2012-07-09 07:27:30

标签: javascript

我得到的选项[text]为null或者不是对象错误。我想在这里做的是我正在检查选择了所有多选查找列值,将它们与数组中的值进行比较然后删除它们

  var responsibleselected = returntags("select","Responsibility selected values");
  for(var i=0;i<responsibleselected.options.length;i++)
  {
       if(responsibleselected.options[i].selected == true)
          {
           for(var j=0;j< ResponsibleArray.length;j++)
            {
 if(responsibleselected.options[i].text == ResponsibleArray[j])//throws error here
             {
       GipRemoveSelectedItems(ctl00_m_g_6ad915a8_68ea_4c76_b67a_ad1215320288_ff391_ctl00_ctl00_MultiLookupPicker_m); 
             }
            }
          }
  }

1 个答案:

答案 0 :(得分:0)

而不是.text您需要.textContent

if(responsibleselected.options[i].textContent == ResponsibleArray[j]){
                                  //   ^--------------here it is