【问题标题】:Append symbol with jquery showing invalid symbol用 jquery 附加符号显示无效符号
【发布时间】:2023-03-30 06:04:01
【问题描述】:

我试图附加一个包含此符号的文本: » 但由于某种原因它不适用于 JQuery。有什么解决方法吗?

脚本:

    jQuery(document).ready(function () {
    jQuery('.six .ovh .entry-content a').hide();
jQuery('.six .ovh .entry-content').each(function() {
    var href   = jQuery(this).prev('header').find('h2 > a').attr('href'),
        anchor = jQuery('<a />', {href: href, text: ' Continue reading »'});

//    jQuery(this).append(anchor);
    jQuery('p:last-child', this).append(anchor);
});

    });
</script

这里是如何显示的:

继续阅读。

【问题讨论】:

  • 什么不起作用? Demo
  • @brbcoding 查看我的脚本 我编辑了我的问题
  • 那时可能会编码。
  • html 编码为 UTF-8

标签: javascript jquery html symbols


【解决方案1】:

将 » 替换为 &amp;raquo;,你应该会很好

【讨论】:

  • 我之前试过但没用,它显示了 $raquo ;
  • 它是&amp;raquo;。 ; 之前没有美元符号和空格
  • 是的@v1cious 我知道,我只是错误地输入了美元符号。
【解决方案2】:

问题解决了,我只是将锚变量从文本更改为 html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    • 1970-01-01
    • 2015-10-19
    • 1970-01-01
    相关资源
    最近更新 更多