简体   繁体   中英

How to convert ascii character in string to character in jquery?

I have an input button :

   <input type="button" class="btn btn-success pull-right" id="doneBtn" value="@Resource.Add (0) @Resource.productsToCampaign" />

@Resource.Add and @Resource.productsToCampaign is dynamicly loaded depends on which language a user have chosen.

The problem is that when i want to update (0) to some number depends on how many items user chooses, @Resource.Add in one language have some special character which encodes to ø when i update value of the button.

what happends when user updates item list :

    var add = '\@Resource.Add';
$("#doneBtn").val(add + '(' + temporarySelectedItems.length + ')' + '@Resource.productsToCampaign');

charcode at will not work, because strings in different languages are not same length

Any ideas?

如果@ Resource.Add不包含'(',我将使用indexof('(')来查找数字的起始位置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM