Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.44 KB | None | 0 0
  1.  for (var x = 0; x < employees.length; x++) {
  2.             var match = true;
  3.             var searchString;
  4.             if (firstName !== '') {
  5.                 searchString = firstName.toLowerCase();
  6.                 if (employees[x].firstName.toLowerCase().indexOf(searchString) == -1) {
  7.                     match = false;
  8.  
  9.                 }
  10.             }
  11.  
  12.             if (lastName !== '') {
  13.                 searchString = lastName.toLowerCase();
  14.                 if (employees[x].lastName.toLowerCase().indexOf(searchString) == -1) {
  15.                     match = false;
  16.                 }
  17.  
  18.             }
  19.  
  20.             if (pointwestUsername !== '') {
  21.                 searchString = pointwestUsername.toLowerCase();
  22.                 if (employees[x].pointwestUsername.toLowerCase().indexOf(searchString) == -1) {
  23.                     match = false;
  24.                 }
  25.  
  26.             }
  27.  
  28.             if (employeeId !== '') {
  29.                 searchString = employeeId.toLowerCase();
  30.                 if (employees[x].employeeId.toLowerCase().indexOf(searchString) == -1) {
  31.                     match = false;
  32.                 }
  33.             }
  34.             if (match) {
  35.                 $("#resultsTable").append("<tr><td>" + employees[x].lastName + "</td><td>" + employees[x].firstName + "</td><td>" + employees[x].seatCode + "</td><td>" + employees[x].localNumber + "</td><td>" + employees[x].availabilityStatus + "</td></tr>");
  36.             }
  37.  
  38.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement