开发者

Weirdness using jquery's .html() function to set <a></a> with a special character &#10003; (checkmark)

开发者 https://www.devze.com 2023-01-03 03:11 出处:网络
I\'m trying to have the followingtag toggle between a \"-\" and the checkmark character (&#10003)

I'm trying to have the following tag toggle between a "-" and the checkmark character (&#10003)

<a id='p_4' cl开发者_JS百科ass='fancy_button orange bls_button' href='#'>-</a>

And here's the jquery code:

        if (button.text() == '-') {
            button.html('&#10003'); }

This works in FF3.6 and IE8, but not in WebKit (Chrome or iPhone safari).

Is there something I'm doing wrong, or does webkit just not like .html("&#10003")

Thanks, Sam


Don't forget the trailing semicolon:

button.html('&#10003;');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号