当作为参数值放置时,字符串不会转换为大写

String will not convert to uppercase when placed as argument value

我正在尝试在 onclick 函数中放置一个动态参数值。问题是它似乎将其转换为小写字母并在其前面添加了一个额外的 space 。 任何帮助将不胜感激,谢谢。

这是我的代码 codepen.io:http://codepen.io/theller5567/pen/GZwBrE?editors=1010

这是我的函数:

createList: function(scope){
      var country = scope;
      var cc = country.countryCode;
      var ccc = cc.toUpperCase();
      console.log(ccc);
      if(ccc){
         var listItem = '<li><a href="#" onclick="setCountry("'+ccc+'","'+country.country+'");getDistribution(event);">'+country.country+'</a></li>';
         return listItem;
      }
 },

这是 dom 中的一个列表项的示例:

<a href="#" onclick="setCountry(" il","israel");getdistribution(event);">Israel</a>

控制台日志将以全大写形式显示所有国家/地区代码,但 dom 中的代码显示为小写形式,并且在其前面还有一个额外的 space。

我的连接引号错了。

createList: function(scope){
      var country = scope;
    var cc = country.countryCode;
    var ccc = cc.toUpperCase();
    console.log(ccc);
    if(ccc){
      var listItem = '<li><a href="#" onclick="setCountry('+ccc+','+country.country+');getDistribution(event);">'+country.country+'</a></li>';
      return listItem;
    }
    },