Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

input search picture jquery

$(document).ready(function() {
  var images = $(".item") //contain all unfiltered images
  $("#filter").on("change paste keyup", function(){
  	$.each(images, function(i, l){
  		$(l).hide();
  	}); //hide all images
  	searchValue = $("#filter").val(); //get entered value of input field
    searchValueRE = new RegExp(searchValue, "i"); //convert search value into RegExp
    output = $.grep(images, function (n) {return searchValueRE.test(n.className); }); //Returns array that matches input value
    $.each(output, function(i, l){
  		$(l).show();
  	}); //show matched images
  });
});
Comment

input search picture jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="live-search" method="post">
  <fieldset>
    <input type="text" class="text-input" id="filter" />
    <span id="filter-count"></span>
  </fieldset>
</form>

<br/>
<br/>

<div id="gallery">
  <div class="item #1 Category-Home Home">
    <a id="#image-link" target="_blank" a href="">
      <img class="img_item"><img src="http://placehold.it/150x151" />

    </a>
  </div>
  <div class="item #2 Category-Kitchen Kitchen">
    <a id="#image-link" target="_blank" a href="">
      <img class="img_item"><img src="http://placehold.it/150x152" />

    </a>
  </div>
    <div class="item #3 Category-Outdoors Outdoors">
      <a id="#image-link" target="_blank" a href="">
        <img class="img_item"><img src="http://placehold.it/150x153" />

      </a>
    </div>
  <div class="item #4 Category-Sports Sports">
    <a id="#image-link" target="_blank" a href="">
      <img class="img_item"><img src="http://placehold.it/150x154" />

    </a>
  </div>
</div>
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to draw flower petals around circle javascript 
Javascript :: str_word_count php js 
Javascript :: what does results.push({}) nodejs mean 
Javascript :: how to set state for logged in users 
Javascript :: requestAnimationFrame without loss context angualar 
Javascript :: express js continous GET /json/version 
Javascript :: receiving big response node js 
Javascript :: heroku h10 error aws 
Javascript :: $set 
Javascript :: tableau js api 
Javascript :: cgi-node example 
Javascript :: ladder physics javascript 
Javascript :: react open on different url instead of localhost 
Javascript :: json identifier with period 
Javascript :: es6 for-of loop 
Javascript :: setup node and mongodb on centos 7 using npm 
Javascript :: what is the difference between explicit parameter and rest parameter javascript 
Javascript :: js date remove am and pm 
Javascript :: configuration file must specify a supported nodejs10 version that is compatible with the runtime specified in the deployment. 
Javascript :: react router not working with aws amplify 
Javascript :: svm with foreach and doMC 
Javascript :: charat javascript in swicth 
Javascript :: resellerclub api with react js 
Javascript :: flutter betterplayer get aspect ratio 
Javascript :: capturar el id de un elemento con jquery 
Javascript :: ngx-search clearing-imp 
Javascript :: redux filter movies list container 
Javascript :: React native country code yarn 
Javascript :: is an array that is in sorted order a min-heap 
Javascript :: what does concurrently package do 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =