I'm using http://codepen.io/anon/pen/gKrln have copy the code and mix it up with my table data. It works on firefox and chrome.
I have change:
document.getElementsByClassName('light-table-filter2');
TO inputs = $(".light-table-filter");
but im not sure how i would change
document.getElementsByClassName(_input.getAttribute('data-table'));
to make it work on IE8?
with the changes I have made only work on firefox and chrome , how can I get it to work on IE8?
var LightTableFilter;
LightTableFilter = (function() {
var _filter, _input, _onInputEvent;
_input = null;
_onInputEvent = (function(_this) {
return function(e) {
var row, table, tables, tbody, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
_input = e.target;
tables = document.getElementsByClassName(_input.getAttribute('data-table'));
for (_i = 0, _len = tables.length; _i < _len; _i++) {
table = tables[_i];
_ref = table.tBodies;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
tbody = _ref[_j];
_ref1 = tbody.rows;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
row = _ref1[_k];
_filter(row);
}
}
}
};
})(this);
_filter = function(row) {
var len, n, text, val, vals, _i, _len;
text = row.textContent.toLowerCase();
vals = _input.value.toLowerCase().split(' ');
len = vals.length;
n = 0;
for (_i = 0, _len = vals.length; _i < _len; _i++) {
val = vals[_i];
if (text.indexOf(val) !== -1) {
n++;
}
}
return row.style.display = n === len ? 'table-row' : 'none';
};
return {
init: function() {
var input, inputs, _i, _len, _results;
inputs = $(".light-table-filter");
_results = [];
for (_i = 0, _len = inputs.length; _i < _len; _i++) {
input = inputs[_i];
_results.push(input.oninput = _onInputEvent);
}
return _results;
}
};
})();
Here is the body :
<section class="container">
<input type="search" class="light-table-filter" data-table="order-table" />
<table class="order-table" >
<thead><th>Name</th><th>Department</th><th>Ext:</th><th>Email</th><th>Title Name</th><th>Cell Phone</th></thead>
<tbody>
<cfoutput query="Branch" >
<tr>
<td >#emp_namefirst# </td>
<td >#dept_name#</td>
<td >#emp_ext#</div></td>
<td >#EMP_EMAIL# </td>
</tr>
</cfoutput>
</tbody>
</table>
</section>