код работает на jsfiddle, но не localhost, почему - PullRequest
0 голосов
/ 22 сентября 2018

мой код работает только на jsfiddle, а не на localhost.Кроме того, мой диапазон цен не будет работать, когда я выберу диапазон цен, он не будет применяться.нужна помощь (я только помещаю этот текст в скобки, потому что мне нужно больше текста) код должен фильтровать div, вы выбираете фильтр, и отображается только этот конкретный идентификатор.Идентификатор применяется и может применяться к нескольким элементам.

myweb.php:

 <div id="solution_finder" class="solution_finder">

  <ul id="filters" style="list-style:none; margin-top:25px; line-height:30px; " class="solutin_finder">
    <li>
      <input type="radio" value="all" checked="checked" id="all" style="display:none;">
    </li>
     <li>
      <input type="radio" value="hoodies" id="hoodies" name="productradio">
      <label for="filter-category">Hoodies</label>
    </li>
    <li>
      <input type="radio" value="shirts" id="shirts" name="productradio">
      <label for="filter-category">shirts</label>
    </li>
    <li>
      <input type="radio" value="accessories" id="accessories" name="productradio">
      <label for="filter-category">accessories</label>
    </li>
    <li>
      <input type="radio" value="other" id="other" name="productradio">
      <label for="filter-category">other</label>
    </li>

  </ul>
  <div style="margin-left:43px;" class="solutin_finder">
  <select id="genre" onChange="return selectOption();">
    <option value="All">price range</option>
    <option value="35">0$-35$</option>
    <option value="36">36$ and over</option>
  </select>
  </div>
  <div style="width:840px; height:148px; clear:both; margin-top:40px; margin-left:43px;" class="solutin_finder">

      <div id="hoodie0007" class="category hoodies 35 all">
        <div class="bgp"></div>
        <a href="buy1.php"><img src="example1.png" class="bgi"></a>
        <p class="bgt">Example Winter coat super cool 21</p>
        <p class="price">35$</p>
        <p class="pricere">45$</p>
        <a href="buy1.php"><button class="atc">View Product</button></a>
        <small class="dic">2 colors<br /> available</small>
    </div>

    <div id="so_air2" class="category other 36 all" ><a href="#" ><h1>iPad Air 2</h1> </a></div>
    <div id="so_air" class="category other 35 all" ><a href="#" ><h1>iPad Air</h1></a></div>
    <div id="so_mini3" class="category 36 accessories all" ><a href="#" ><h1>iPad mini 3</h1></a></div>
    <div id="so_mini2" class="category 36 shirts all" ><a href="#" > <h1>iPad mini 2</h1> </a></div>
    <div id="so_mjni" class="category 35 other all" ><a href="#" > <h1>iPad mini</h1> </a></div>

  </div>

</div>
        <script>
        $('input').change (function() {
        var selector = $('input:radio').map(function(){ 
            return this.checked ? '.' + this.id : ''; 
        }).get().join('');
        var all = $('div[class^="category"]');
        if(selector.length)
          all.hide().filter(selector).show()
        else all.hide();
            });
</script>  

http://jsfiddle.net/rc5ctjez/76/

...