javascript – jQuery: search name without spacing

I’m a newbie to jQuery/JavaScript. During my learning process, I found a search filter code from W3schools by using jQuery. I have tried to used it in my code and it worked well. Now, I wonder how could I get the search result without spacing when I enter the names? For example, one of my data is
‘Jacky Chan’, and I wish that I can get the search result by just entering ‘jackychan””Jackyc””JackyChan””jackyc’. Thanks in advance.

<!DOCTYPE html>
<script src=""></script>
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myList li").filter(function() {
  $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)

<input id="myInput" type="text" placeholder="Search..">

<ul id="myList">
  <li>Jacky Chan</li>
  <li>Lim Hai Yang</li>
  <li>Soul Wong</li>