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

              
                
<section class="container">

	<input type="search" class="light-table-filter" data-table="order-table" placeholder="検索" />

	<table class="order-table">
		<thead>
			<tr>
				<th>名前</th>
				<th>職業</th>
				<th>住所</th>
				<th>年齢</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>はなこ</td>
				<td>医師(いし)</td>
				<td>新潟県(にいがた)</td>
				<td>38</td>
			</tr>
			<tr>
				<td>たけし</td>
				<td>海洋研究(かいようけんきゅう)</td>
				<td>岡山県(おかやま)</td>
				<td>48</td>
			</tr>
			<tr>
				<td>えり</td>
				<td>AI開発(えーあいかいはつ)</td>
				<td>徳島県(とくしま)</td>
				<td>25</td>
			</tr>
			<tr>
				<td>けんじ</td>
				<td>大学教授(だいがくきょうじゅ)</td>
				<td>長崎県(ながさき)</td>
				<td>61</td>
			</tr>
			<tr>
				<td>あきお</td>
				<td>俳優(はいゆう)</td>
				<td>山口県(やまぐち)</td>
				<td>33</td>
			</tr>
			<tr>
				<td>みなこ</td>
				<td>刑事(けいじ)</td>
				<td>鳥取県(とっとり)</td>
				<td>41</td>
			</tr>
			<tr>
				<td>まみ</td>
				<td>学生(がくせい)</td>
				<td>福島県(ふくしま)</td>
				<td>18</td>
			</tr>
		</tbody>
	</table>

</section>

              
            
!

CSS

              
                


.container {
  text-align: center;
  overflow: hidden;
  width: 600px;
  margin: 0 auto;
}

.container table {
  width: 100%;
}

.container td, .container th {
  padding: 10px;
}

.container td:first-child, .container th:first-child {
  padding-left: 20px;
}

.container td:last-child, .container th:last-child {
  padding-right: 20px;
}

.container th {
  border-bottom: 1px solid #ddd;
  position: relative;
}

              
            
!

JS

              
                (function(document) {
	'use strict';

	var LightTableFilter = (function(Arr) {

		var _input;

		function _onInputEvent(e) {
			_input = e.target;
			var tables = document.getElementsByClassName(_input.getAttribute('data-table'));
			Arr.forEach.call(tables, function(table) {
				Arr.forEach.call(table.tBodies, function(tbody) {
					Arr.forEach.call(tbody.rows, _filter);
				});
			});
		}

		function _filter(row) {
			var text = row.textContent.toLowerCase(), val = _input.value.toLowerCase();
			row.style.display = text.indexOf(val) === -1 ? 'none' : 'table-row';
		}

		return {
			init: function() {
				var inputs = document.getElementsByClassName('light-table-filter');
				Arr.forEach.call(inputs, function(input) {
					input.oninput = _onInputEvent;
				});
			}
		};
	})(Array.prototype);

	document.addEventListener('readystatechange', function() {
		if (document.readyState === 'complete') {
			LightTableFilter.init();
		}
	});

})(document);
              
            
!
999px

Console