为什么是& reg;与jQuery一起使用时不起作用 [英] why is ® not working when used with jquery

查看:121
本文介绍了为什么是& reg;与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 &reg;" />

但是当我使用下面的jquery时,它以纯文本形式返回:

But when I used jquery as below it returns as plain text:

$('.button_a').each(function(){
    $(this).attr("value",$(this).attr("value")+" &reg;");
});

我不想通过在所有按钮的值中放置&reg;来浪费我的时间和空间,所以我希望在jquery中完成它,但是我在做什么不正确.

I don't want to waste my time and space by putting &reg; 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

谢谢....

推荐答案

&reg;被呈现为文本字符串,但是您可以使用unicode \u00AE

&reg; is being rendered as a text string, but you can use unicode \u00AE

$('.button_a').each(function(){
    this.value = this.value +" \u00AE";
});

http://jsfiddle.net/fbuohvm1/

或仅®:

$('.button_a').each(function(){
    this.value = this.value +" ®";
});

http://jsfiddle.net/fbuohvm1/1/

这篇关于为什么是&amp; reg;与jQuery一起使用时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆