为什么是& reg;与jQuery一起使用时不起作用 [英] why is ® not working when used with jquery
问题描述
我遇到一个问题,我想在按钮上附加一个注册商标符号,并且希望通过jquery完成,因为例如,当我将其与html一起使用时,有很多按钮都需要符号(以下)它奏效了.
I am having a problem I want to attach the registered trademark symbol a button and I want it to be done with jquery because there are lots and lots of buttons that require the sign when I used it with html for example(below) it worked.
<input type="button" class="button_a" value="Value ®" />
但是当我使用下面的jquery时,它以纯文本形式返回:
But when I used jquery as below it returns as plain text:
$('.button_a').each(function(){
$(this).attr("value",$(this).attr("value")+" ®");
});
我不想通过在所有按钮的值中放置®
来浪费我的时间和空间,所以我希望在jquery中完成它,但是我在做什么不正确.
I don't want to waste my time and space by putting ®
in all the button's values so I want it to be done in jquery but what am I doing incorrect.
我知道这是一个缓慢的问题,但是请有人帮助我解决这个问题
I know it's a sluggish question but please someone help out me in this question
也可以使用Javascript.
Javascript may be also used.
有关更多信息,请发表评论并询问
For more info please comment and ask
谢谢....
推荐答案
®
被呈现为文本字符串,但是您可以使用unicode \u00AE
®
is being rendered as a text string, but you can use unicode \u00AE
$('.button_a').each(function(){
this.value = this.value +" \u00AE";
});
或仅®
:
$('.button_a').each(function(){
this.value = this.value +" ®";
});
http://jsfiddle.net/fbuohvm1/1/
这篇关于为什么是& reg;与jQuery一起使用时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!