Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function listFilter(header, list) { // header is any element, list is an unordered list
- // create and add the filter form to the header
- //var form = $("<form>").attr({ "class": "filterform", "action": "#" }),
- // input = $("<input>").attr({ "class": "clientfilterinput", "type": "text", "placeholder": "Search for a client" });
- input = $("input.clientfilterinput");
- //$(form).append(input).appendTo(header);
- //var placeholder = $('input.clientfilterinput').attr("placeholder");
- //$('input.clientfilterinput').val(placeholder);
- $(input)
- .change(function () {
- var filter = $.trim($(this).val());
- if (filter) {
- // this finds all links in a list that contain the input,
- // and hide the ones not containing the input while showing the ones that do
- $(list).find("h4:not(:Contains(" + filter + "))").parent().parent().fadeOut();
- $(list).find("h4:Contains(" + filter + ")").parent().parent().fadeIn();
- $(".clientPager").hide();
- $(".createClientContainer").hide();
- } else {
- $(list).find("h4").parent().parent().show();
- $(".createClientContainer").show();
- $(".clientPager").remove();
- $(".simplePagerNav a").unbind();
- runPager()
- }
- return false;
- })
- .keyup(function () {
- // fire the above change event after every letter
- $(this).change();
- });
- }
Add Comment
Please, Sign In to add comment