I am using uniformjs form controls which are working except the listmenu. When i add '&' symbol (&) inthe list menu, it renders correctly, but problem is coming when i change the value to different value and select again the value which has & symbol it renders as &
instead '&' symbol in the list menu.
<select>
<option>Through & Google</option>
<option>Through Twitter</option>
<option>Other…</option>
<option><Hi></option>
</select>
can someone tell me what is the problem..
I think the problem might come from this line (source - line 185):
spanTag.text(elem.find(":selected").html());
If you have the following html:
<select>
<option>One & Two</option>
<option>One & Two</option>
</select>
The plugin gets the content as html doing elem.find(":selected").html()
Both option element will return this value when getting html: One & Two
Special characters are represented by html entities (&
for &
in our example)
and then plugin applies this result as text using spanTag.text(<html>);
So html entities do not get parsed (&
is displayed as &
)
This fiddle illustrates it.
I don't think there is a solution to that except to not use special characters like &
...