【问题标题】:Select-Tag Default Selection Ignored by IE8 when using Handlebars with Meteor使用带有 Meteor 的 Handlebars 时,选择标记默认选择被 IE8 忽略
【发布时间】:2012-11-20 01:58:18
【问题描述】:

我创建了一个空白 Meteor 项目并尝试在车把 HTML 文件中放置一个

<head><title>test</title>
</head>
<body>
  <select>
    <option>abc</option>
    <option selected="selected">def</option>
    <option>ghi</option>
  </select>
</body>

所以 IE8 显示“abc”作为选择的选项。

我也尝试过编写 Handlebar 辅助函数,结果相同:

<head><title>test</title>
</head>
<body>
  {{{hbarselect}}}
</body>

// in the js file
Handlebars.registerHelper("hbarselect", function(value) {
    var ret = '';
    ret = '<select>';
    ret += '<option>abc</option>';
    ret += '<option selected="selected">def</option>';
    ret += '<option>ghi</option>';
    ret += '</select>';
    return new Handlebars.SafeString(ret);;
  });

如果我完全忽略 Handlebars,只写一个简单的 HTML 文件,那么 IE8 会正常运行:

<html>
<head>
</head>
<body>
<select>
<option>abc</option>
<option selected="selected">def</option>
<option>ghi</option>
</select>
</body>
</html>

要完成这项工作,我需要了解有关 Handlebars 的一些信息吗?我该如何解决这个问题?

【问题讨论】:

标签: internet-explorer-8 meteor handlebars.js


【解决方案1】:

也许这种丢失选定状态的解决方法可能会有所帮助?

https://stackoverflow.com/a/13013326/1758461

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-08
    • 2017-11-02
    • 2016-01-07
    • 2014-04-14
    • 1970-01-01
    • 2012-12-12
    相关资源
    最近更新 更多