Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.56 KB | None | 0 0
  1. function search() {
  2.     $("input[name=search]").on("input", function () {
  3.         var value = $(this).val();
  4.         if (value.length > 3) {
  5.             $("div.work").each(function (i, html) {
  6.                 var _this = $(this);
  7.                 var title = $(html).find(".text-title-work").text();
  8.                 var description = $(html).find(".text-description-work").text();
  9.  
  10.                 (title.indexOf(value) >= 0 || description.indexOf(value) >= 0) ? _this.css('display', 'block') : _this.css('display', 'none');
  11.             });
  12.         }
  13.     });
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement