<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css">
<input id="q" type="search" />
<script type="text/javascript">
docsearch({
apiKey: '25626fae796133dc1e734c6bcaaeac3c',
indexName: 'docsearch',
inputSelector: '#q',
transformData: function(hits) {
// modify hits
hits.map(hit => {
// If hit has an anchor, let's replace it with nothing and then slice to remove the #.
// The console.log looks right, but the widget is still pointing to the URL with hash :(
// Oddly, if you remove the `.slice(0, -1)`, it will start working - but it leaves a meaningless # at the end of the url :(
hit.url.replace(hit.anchor, '').slice(0, -1)
})
console.log(hits);
return hits;
},
debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.