我可以通过<b>标签

Can I filter a returned JSON by <b> tag?

本文关键字:标签 gt lt 可以通过      更新时间:2023-09-26

我一直在玩这个jquery wiki插件。然而,我被一个我想完成的特定功能卡住了。有没有办法过滤返回的数据,只显示粗体或<b>标记中的项目。我有以下代码:

<body>
<h1>Wikiblurb</h1>
<div id="article"></div>
<script src="js/jquery.wikiblurb.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('#article').wikiblurb();
});
</script>
</body>

js文件的主要自定义是:

var defaults = $.extend({
        wikiURL: "http://en.wikipedia.org/",
        apiPath: 'w',
        section: 2,
        page: 'List of reportedly haunted locations',
        removeLinks: true,      
        type: 'all',
        customSelector: '',
        }, options);

以前有人使用过这个插件吗?或者告诉我如何只显示返回的<b>标记中的位置。

Js文件:http://jsfiddle.net/xvubbo0s/
供参考的页面:http://en.wikipedia.org/wiki/List_of_reportedly_haunted_locations(我只想返回澳大利亚标题下的链接文本)
供参考的插件:https://github.com/9bitStudios/wikiblurb

从插件引用来看,设置type: 'custom'customSelector: 'b'似乎可以满足您的要求。

我创建了这个插件的一个分叉,并添加了一个filterSelector来完成你要求的最后一项。您可以在此处找到分叉存储库。

在设置中添加filterSelector: "a:contains('^')"