2

これは私が持っているものです: ここに画像の説明を入力

そして今、私はライブ検索をしたいと思っています。ポイントは、テキストボックスに入力すると、検索ボックス内のテキストと等しいものを使用してローカルストレージを自動的に検索する必要があるということです。一致しないデータはすべて消えます。

$("#searchbox").keyup(function(){

    // Retrieve the input field text
    var searchtext = $(this).val();

    // Loop through the local storage
    var a = {};
    a = JSON.parse(localStorage.getItem('session'));

    alert(a);
});

ご覧のとおり、アラートを作成すると、出力は次のようになります。

{"21114":{"id":"21114","external_id":"","sessiongroupid":"1844","eventid":"5588","order":"0","name":"localStorage
 HTML5 Session","description":"localstorage","starttime":"2013-04-23
 12:00:00","endtime":"2013-04-23
 13:30:00","speaker":"","location":"","mapid":"0","xpos":"0.000000","ypos":"0.000000","maptype":"plan","imageurl":"","presentation":"","organizer":"0","twitter":"","allowAddToFavorites":"0","allowAddToAgenda":"0","votes":"0","url":"","venueid":"0"},"21115":{"id":"21115","external_id":"","sessiongroupid":"1845","eventid":"5588","order":"0","name":"tweede","description":"tweede","starttime":"2013-04-03
 00:00:00","endtime":"2013-04-04
 00:00:00","speaker":"","location":"","mapid":"0","xpos":"0.000000","ypos":"0.000000","maptype":"plan","imageurl":"","presentation":"","organizer":"0","twitter":"","allowAddToFavorites":"0","allowAddToAgenda":"0","votes":"0","url":"","venueid":"0"}}

今、私は名前で検索したいと思います。誰かがこれを行う方法を手伝ってもらえますか?

4

2 に答える 2