Guest User

Untitled

a guest
Oct 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. function listFilter(header, list) { // header is any element, list is an unordered list
  2. // create and add the filter form to the header
  3. //var form = $("<form>").attr({ "class": "filterform", "action": "#" }),
  4. // input = $("<input>").attr({ "class": "clientfilterinput", "type": "text", "placeholder": "Search for a client" });
  5. input = $("input.clientfilterinput");
  6. //$(form).append(input).appendTo(header);
  7. //var placeholder = $('input.clientfilterinput').attr("placeholder");
  8. //$('input.clientfilterinput').val(placeholder);
  9. $(input)
  10. .change(function () {
  11. var filter = $.trim($(this).val());
  12. if (filter) {
  13. // this finds all links in a list that contain the input,
  14. // and hide the ones not containing the input while showing the ones that do
  15.  
  16. $(list).find("h4:not(:Contains(" + filter + "))").parent().parent().fadeOut();
  17. $(list).find("h4:Contains(" + filter + ")").parent().parent().fadeIn();
  18. $(".clientPager").hide();
  19. $(".createClientContainer").hide();
  20. } else {
  21. $(list).find("h4").parent().parent().show();
  22. $(".createClientContainer").show();
  23. $(".clientPager").remove();
  24. $(".simplePagerNav a").unbind();
  25. runPager()
  26. }
  27. return false;
  28. })
  29. .keyup(function () {
  30. // fire the above change event after every letter
  31. $(this).change();
  32. });
  33. }
Add Comment
Please, Sign In to add comment