1

スパン クラス 'date' を使用して、月ごとにフィルター処理するボタンを配置したいニュース ページがあります。list.js を使用すると、正確に一致する文字列を使用してのみフィルター処理できます。November という単語を含むすべてのアイテムを表示するために使用できるワイルドカードはありますか

HTML

<button class="btn" id="filter-oct">October</button>
<button class="btn" id="filter-nov">November</button>
<div class="newsitem">
    <h2>News title</h2>
    <p><span class="date">Thursday 31 November 2013</span> Some text, more text</p>
    <p>Should you have any concerns, require additional information or wish to discuss this matter further please contact me</p>
</div>

JS

<script type="text/javascript">
  var options = {
    valueNames: [ 'date' ]
  };
  var featureList = new List('election-list', options);
  $('#filter-nov').click(function() {
    featureList.filter(function(item) {
      if (item.values().date == "November 2013") {
        return true;
      } else {
        return false;
      }
    });
    return false;
    });
</script>

マッチングを行うのはこの行にありますが、正確な単語のみに一致します

if (item.values().date == "2013 年 11 月") {

&= と ^= を使用して一致を取得しようとしましたが、どちらも機能しません。

ありがとう

4

0 に答える 0