Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Could I trigger a search by modifying the Element value? #175

Closed
Mabbs opened this issue Jul 22, 2021 · 1 comment
Closed

Could I trigger a search by modifying the Element value? #175

Mabbs opened this issue Jul 22, 2021 · 1 comment

Comments

@Mabbs
Copy link

Mabbs commented Jul 22, 2021

Hi, I have a question, when I modify the value of the element directly, such as modify by query value, it seems that this module can't work. How can I trigger it to work?

My current work

function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
var mykeyword = GetQueryString("keyword");
var sbox = document.getElementById('search-input');
if(mykeyword !=null && mykeyword.toString().length>1)
{
sbox.value = mykeyword;
}
var sjs = SimpleJekyllSearch({
  searchInput: sbox,
  resultsContainer: document.getElementById('results-container'),
  json: '/search.json',
  searchResultTemplate: '<li>{date} - <a href="{{ site.url }}{url}">{title}</a></li><br>'
})
@Mabbs
Copy link
Author

Mabbs commented Jul 22, 2021

Not this question, I will create a new issue.

@Mabbs Mabbs closed this as completed Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant