javascript - Loading arrays through select2 with text containing HTML-entities are not showing as the special characters -


<!doctype html> <html> <head>     <meta charset="utf-8" />     <title>test</title>     <link rel="stylesheet" type="text/css" href="stylesheet.css" />     <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" /> </head> <body>     <div>         <select style="width: 50%" id="div">          </select>     </div>     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>     <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>     <script type="text/javascript" src="javascript.js"></script> </body> 

and in javascript:

$('select').select2();     array = [     { id: 0, text: "&mu;" },     { id: 1, text: "&cent;" }, ];  $("#div").select2({ data: array }) 

the result select option "& m u ; " , "& c e n t;" , not "&mu;" , "&cent;". have idea how fix this?

i see

array = [ { id: 0, text: "&mu;" }, { id: 1, text: "&cent;" },]; 

you have no problems coding? example of working symbols - http://codepen.io/anon/pen/oxomlp


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -