1

我有两个选择标签,第一个标签的内容支配第二个标签的内容。At this point, it's resolved so that when a selection fires an even, the latter is repopulated with new values.

我正在考虑用所有项目填充它,但仅将样式设置为在与前者的选择相对应的项目上可见。但是,我注意到以下内容并没有影响外观。

return "<option"
  + " style='display: none;'"
  + " value=" + value
  + ">" + text + "</option>"

我怎样才能实现我的愿望?

4

1 回答 1

1

有时很多时候 IE 真的很臭。所以display: none; 在其他浏览器中工作正常,但基本上在 IE 中“隐藏”它的唯一有效方法是将其注释掉(这是跨浏览器)。所以你需要让你的代码是:

return "<!--<option"
  + " style='display: none;'"
  + " value=" + value
  + ">" + text + "</option>-->"

但是,那么问题是,这真的对您有帮助吗?还是像您正在做的那样动态填充值更好。

于 2013-06-15T16:16:20.937 回答