Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <table id="myTable" class="order-table table tab1">
<thead>
<tr><th colspan="3"><input id="tri" type="text" class="table-filter" data-table="order-table" placeholder="Item to filter.." /><a href="#" class="button" onclick="recharge()">↺</a></th></tr>
<tr><th id="a">Nom du service</th><th id="b">Etat</th><th id="c">Démarrage conseillé</th></tr>
</thead>
<tbody id="tbody1">
<tr><td>Accès du périphérique d'interface utilisateur</td><td></td><td>Désactivé</td></tr>
<tr><td>Acquisition d'image Windows (WIA)</td><td></td><td>Manuel</td></tr>
<tr><td>Agent de protection d’accès réseau</td><td></td><td>Désactivé</td></tr>
<tr><td>Agent de stratégie IPsec</td><td>Démarré</td><td>Manuel</td></tr>
<tr><td>Alimentation</td><td>Démarré</td><td>Automatique</td></tr>
<tr><td>Appel de procédure distante (RPC)</td><td>Démarré</td><td>Automatique</td></tr>
<tr><td>Application Host Helper Service</td><td></td><td>Automatique</td></tr>
<tr><td>Application système COM+</td><td></td><td>Manuel</td></tr>
<tr><td>Assistance IP</td><td></td><td>Désactivé</td></tr>
<tr><td>Assistance NetBIOS sur TCP/IP</td><td></td><td>Désactivé</td></tr>
<tr><td>Audio Windows</td><td>Démarré</td><td>Automatique</td></tr>
</tbody>
</table>
              
            
!

CSS

              
                * {font-family: "Fira Sans", sans-serif;}
table {
	border-collapse: collapse;
	background-color: #5d625c;
	margin:auto;
}
th, td {padding: 2px 5px}
thead > tr:nth-child(-n+2) {
	color: white;
	text-align: center;
	background-color: #5d625c;
}
tr:nth-child(odd) {
  background-color: #dddad4;
  border-bottom:1px solid #5d625c;
  color:#444;
}
tr:nth-child(even) {
  background-color: #c6c3bd;
  border-bottom:1px solid #5d625c;
  color:#444;
}
.inpres {background-color: red}
.button {
	padding: 2px 4px;
	text-align: center;
	color: #ffffff;
	border-radius: 2px;
	text-decoration: none;
	font-size: 12px;
	background-color: #1227ef;
	box-shadow: inset 2px 2px 3px #828bc5, inset -2px -2px 2px #382f8299;
}
.button:active {color:#5d625c;}
              
            
!

JS

              
                compare = function(ids, asc){
	return function(row1, row2){
		tdValue = function(row, ids){
			return row.children[ids].textContent;
		}
		tri = function(v1, v2){
			if (v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2)){return v1 - v2}
			else {return v1.toString().localeCompare(v2)}
			return v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2);
		}
		return tri(tdValue(asc ? row1 : row2, ids), tdValue(asc ? row2 : row1, ids));
	}
}
tbody = document.querySelector('#tbody1');
thx = document.querySelectorAll('#a, #b, #c');
trxb = tbody.querySelectorAll('tr');
thx.forEach(function(th){
	th.addEventListener('click', function(){
		var verifid = document.getElementsByClassName('resultat2').length;
		console.log(verifid);
		if(verifid >= 0) {
			for (var k = 1; k<=verifid; k++) {
			let p2 = document.getElementById('resultat1');
			p2.remove();
			console.log(k);
			}
		}
		let classe = Array.from(trxb).sort(compare(Array.from(thx).indexOf(th), this.asc = !this.asc));
		classe.forEach(function(tr){
			tbody.appendChild(tr)
		});
	})
});
var compt = tbody.querySelectorAll('tr').length + 1;
for (var i = 1; i < compt; i++) {
	ajt = tbody.querySelector('tr:nth-of-type('+i+')').querySelector('td');
	ajt.innerHTML="<input type='checkbox'> " + ajt.innerHTML;
}
document.addEventListener( 'DOMContentLoaded', function() {

	const thisTable = document.getElementById('tbody1');
	let initialTable = [];
	
	for ( let i = 0; i < thisTable.rows.length; i++ ) {

		initialTable[i] = [];
		const objCells = thisTable.rows.item(i).cells;

		for ( let j = 0; j < objCells.length; j++ ) initialTable[i][j] = objCells.item(j).innerText;

	}

	document.getElementById("tri").addEventListener('keyup',  event => {

		const inputValue = document.getElementById("tri").value;
		
		if ( inputValue != '' || inputValue != 'undefined') {
		
			thisTable.innerHTML = "";

			for ( let i = 0; i < initialTable.length; i++ ) {

				if ( initialTable[i][0].toLowerCase().indexOf(inputValue.toLowerCase()) > -1
					 || initialTable[i][1].toLowerCase().indexOf(inputValue.toLowerCase()) > -1
					 || initialTable[i][2].toLowerCase().indexOf(inputValue.toLowerCase()) > -1
					) {

					thisTable.innerHTML += '<tr class="resultat2" id="resultat1" ><td>'+initialTable[i][0]+'</td><td>'+initialTable[i][1]+'</td><td>'+initialTable[i][2]+'</td></tr>';
					
				}

			}

		} else {
		
			for ( let i = 0; i < initialTable.length; i++ ) {

				thisTable.innerHTML = '<tr><td>'+initialTable[i][0]+'</td><td>'+initialTable[i][1]+'</td><td>'+initialTable[i][2]+'</td></tr>';

			}
		
		}


	});
	
});
              
            
!
999px

Console