Rav*_*avi 5 javascript jquery listview character-encoding uniform
我正在使用uniformjs表单控件,除了listmenu之外它们正在工作.当我在列表菜单中添加'&'符号(&)时,它会正确呈现,但是当我将值更改为不同的值并再次选择具有&符号的值时,问题就会出现,&而不是它呈现为列表中的'&'符号菜单.


<select>
<option>Through & Google</option>
<option>Through Twitter</option>
<option>Other…</option>
<option><Hi></option>
</select>
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这是什么问题..
我认为问题可能来自这一行(源代码- 第 185 行):
spanTag.text(elem.find(":selected").html());
Run Code Online (Sandbox Code Playgroud)
如果您有以下 html:
<select>
<option>One & Two</option>
<option>One & Two</option>
</select>
Run Code Online (Sandbox Code Playgroud)
该插件以html方式获取内容elem.find(":selected").html()
获取 html 时,两个选项元素都会返回此值:One & Two
特殊字符由 html 实体表示(&在&我们的示例中)
然后插件使用此结果作为文本应用spanTag.text(<html>);
所以 html 实体不会被解析(&显示为&)
这把小提琴就说明了这一点。
&我认为除了不使用特殊字符(例如...)之外没有其他解决方案