HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<!-- 検索用プルダウンフォームを、絞り込みたいテーブルより前に設置します -->
<div class="search-area">
<script src="js/search.js"></script>
<form method="get" action="">
<select id="blood" name="">
<option value="">血液型を選んでください
<option value="A型">A型
<option value="B型">B型
<option value="AB型">AB型
<option value="O型">O型
</select>
<select id="birth" name="">
<option value="">誕生月を選んでください
<option value="/1/">1月
<option value="/2/">2月
<option value="/3/">3月
<option value="/4/">4月
<option value="/5/">5月
<option value="/6/">6月
<option value="/7/">7月
<option value="/8/">8月
<option value="/9/">9月
<option value="/10/">10月
<option value="/11/">11月
<option value="/12/">12月
</select>
<input type="button" value="絞り込む" id="button"> <input type="button" value="すべて表示" id="button2">
</form>
</div>
<!-- データのテーブルのidはjsのフックになっています -->
<table id="data" border="0" cellspacing="0">
<thead>
<tr><th></th><th>名前</th><th>ふりがな</th><th>性別</th><th>誕生日</th><th>血液型</th><th>都道府県</th><th>カレーの食べ方</th></tr>
</thead>
<tbody>
<tr><td>1</td><td>島 慶太</td><td>しま けいた</td><td>男</td><td>2016/8/12</td><td>O型</td><td>北海道</td><td>左ルー・ルー攻め派</td></tr>
<tr><td>2</td><td>島袋 真一</td><td>しまぶくろ しんいち</td><td>男</td><td>2017/1/1</td><td>A型</td><td>神奈川県</td><td>ぶっかけ・別口派</td></tr>
<tr><td>3</td><td>外山 千夏</td><td>そとやま ちなつ</td><td>女</td><td>2016/6/15</td><td>O型</td><td>新潟県</td><td>左ルー・別口派</td></tr>
<tr><td>4</td><td>大木 浩介</td><td>おおき こうすけ</td><td>男</td><td>2017/3/6</td><td>A型</td><td>静岡県</td><td>ぶっかけ・別口派</td></tr>
<tr><td>5</td><td>木本 美優</td><td>きもと みゅう</td><td>女</td><td>2016/12/8</td><td>O型</td><td>大阪府</td><td>左ルー・ルー攻め派</td></tr>
<tr><td>6</td><td>阿井 薫</td><td>あい かおる</td><td>女</td><td>2017/2/28</td><td>AB型</td><td>群馬県</td><td>ぶっかけ・ナン派</td></tr>
<tr><td>7</td><td>飯島 真吾</td><td>いいじま しんご</td><td>男</td><td>2016/11/7</td><td>O型</td><td>愛知県</td><td>手前ルー・ルー攻め派</td></tr>
<tr><td>8</td><td>永田 恵梨香</td><td>ながた えりか</td><td>女</td><td>2017/3/27</td><td>A型</td><td>新潟県</td><td>ぶっかけ・別口派</td></tr>
<tr><td>9</td><td>立花 秀隆</td><td>たちばな ひでたか</td><td>男</td><td>2017/5/6</td><td>O型</td><td>長野県</td><td>奥ルー・せき止め派</td></tr>
<tr><td>10</td><td>木下 早織</td><td>きのした さおり</td><td>女</td><td>2017/3/4</td><td>A型</td><td>兵庫県</td><td>ぶっかけ・混ぜ混ぜ派</td></tr>
<tr><td>11</td><td>三谷 獅童</td><td>みたに しどう</td><td>男</td><td>2017/2/20</td><td>B型</td><td>千葉県</td><td>ぶっかけ・ルー攻め派</td></tr>
<tr><td>12</td><td>杉村 由宇</td><td>すぎむら ゆう</td><td>女</td><td>2016/6/11</td><td>A型</td><td>埼玉県</td><td>左ルー・別口派</td></tr>
<tr><td>13</td><td>赤松 明日</td><td>あかまつ めいび</td><td>女</td><td>2016/12/23</td><td>B型</td><td>千葉県</td><td>別盛り・ルー攻め派</td></tr>
<tr><td>14</td><td>西沢 染五郎</td><td>にしざわ そめごろう</td><td>男</td><td>2016/9/2</td><td>O型</td><td>東京都</td><td>奥ルー・混ぜ混ぜ派</td></tr>
<tr><td>15</td><td>福山 碧海</td><td>ふくやま おうが</td><td>男</td><td>2016/8/3</td><td>AB型</td><td>東京都</td><td>手前ルー・ルー攻め派</td></tr>
<tr><td>16</td><td>茂木 ひろ子</td><td>もぎ ひろこ</td><td>女</td><td>2017/3/14</td><td>AB型</td><td>東京都</td><td>ぶっかけ・ルー攻め派</td></tr>
<tr><td>17</td><td>宍戸 優一</td><td>ししど ゆういち</td><td>男</td><td>2016/11/26</td><td>B型</td><td>山形県</td><td>左ルー・せき止め派</td></tr>
<tr><td>18</td><td>羽田 真奈美</td><td>はだ まなみ</td><td>女</td><td>2016/8/24</td><td>AB型</td><td>北海道</td><td>左ルー・ルー攻め派</td></tr>
<tr><td>19</td><td>土屋 奈央</td><td>つちや なお</td><td>女</td><td>2017/2/5</td><td>O型</td><td>埼玉県</td><td>右ルー・ルー攻め派</td></tr>
<tr><td>20</td><td>滝口 恵梨香</td><td>たきぐち えりか</td><td>女</td><td>2016/7/31</td><td>AB型</td><td>愛知県</td><td>左ルー・せき止め派</td></tr>
<tr><td>21</td><td>多部 理紗</td><td>たべ りさ</td><td>女</td><td>2017/5/20</td><td>B型</td><td>大阪府</td><td>左ルー・せき止め派</td></tr>
<tr><td>22</td><td>浅見 那奈</td><td>あさみ なな</td><td>女</td><td>2016/9/7</td><td>A型</td><td>東京都</td><td>左ルー・せき止め派</td></tr>
<tr><td>23</td><td>安永 慶太</td><td>やすなが けいた</td><td>男</td><td>2016/6/16</td><td>B型</td><td>広島県</td><td>別盛り・ルー攻め派</td></tr>
<tr><td>24</td><td>長崎 栄一</td><td>ながさき えいいち</td><td>男</td><td>2016/10/21</td><td>A型</td><td>北海道</td><td>手前ルー・別口派</td></tr>
<tr><td>25</td><td>野崎 恭子</td><td>のざき きょうこ</td><td>女</td><td>2016/11/3</td><td>O型</td><td>島根県</td><td>奥ルー・別口派</td></tr>
<tr><td>26</td><td>佐々木 隆</td><td>ささき たかし</td><td>男</td><td>2016/9/15</td><td>A型</td><td>広島県</td><td>奥ルー・せき止め派</td></tr>
<tr><td>27</td><td>勝田 裕次郎</td><td>かつだ ゆうじろう</td><td>男</td><td>2016/7/26</td><td>A型</td><td>熊本県</td><td>左ルー・別口派</td></tr>
<tr><td>28</td><td>前田 早織</td><td>まえだ さおり</td><td>女</td><td>2016/9/30</td><td>A型</td><td>千葉県</td><td>左ルー・せき止め派</td></tr>
<tr><td>29</td><td>小出 窈</td><td>こいで よう</td><td>女</td><td>2016/10/7</td><td>O型</td><td>広島県</td><td>ぶっかけ・ルー攻め派</td></tr>
<tr><td>30</td><td>成海 美嘉</td><td>なるみ みか</td><td>女</td><td>2016/10/30</td><td>A型</td><td>奈良県</td><td>右ルー・別口派</td></tr>
<tr><td>31</td><td>森山 愛</td><td>もりやま あい</td><td>女</td><td>2016/8/19</td><td>A型</td><td>愛知県</td><td>左ルー・せき止め派</td></tr>
<tr><td>32</td><td>藤田 由美子</td><td>ふじた ゆみこ</td><td>女</td><td>2017/2/16</td><td>O型</td><td>山口県</td><td>右ルー・ルー攻め派</td></tr>
<tr><td>33</td><td>小泉 達士</td><td>こいずみ たつひと</td><td>男</td><td>2017/1/9</td><td>AB型</td><td>沖縄県</td><td>ぶっかけ・ルー攻め派</td></tr>
<tr><td>34</td><td>土田 長利</td><td>つちだ ながとし</td><td>男</td><td>2017/3/21</td><td>O型</td><td>北海道</td><td>奥ルー・別口派</td></tr>
<tr><td>35</td><td>戸田 耕司</td><td>とだ こうじ</td><td>男</td><td>2016/7/30</td><td>O型</td><td>福岡県</td><td>左ルー・ナン派</td></tr>
<tr><td>36</td><td>高島 たかお</td><td>たかしま たかお</td><td>男</td><td>2016/10/26</td><td>O型</td><td>栃木県</td><td>左ルー・別口派</td></tr>
<tr><td>37</td><td>杉本 菜々美</td><td>すぎもと ななみ</td><td>女</td><td>2017/4/25</td><td>O型</td><td>東京都</td><td>左ルー・混ぜ混ぜ派</td></tr>
<tr><td>38</td><td>桜井 晋也</td><td>さくらい しんや</td><td>男</td><td>2016/5/29</td><td>O型</td><td>大阪府</td><td>左ルー・せき止め派</td></tr>
<tr><td>39</td><td>小沼 莉沙</td><td>こぬま りさ</td><td>女</td><td>2017/1/29</td><td>O型</td><td>鹿児島県</td><td>左ルー・混ぜ混ぜ派</td></tr>
<tr><td>40</td><td>野沢 薫</td><td>のざわ かおる</td><td>男</td><td>2016/11/14</td><td>A型</td><td>北海道</td><td>ぶっかけ・別口派</td></tr>
<tr><td>41</td><td>大島 ひとり</td><td>おおしま ひとり</td><td>男</td><td>2016/6/24</td><td>A型</td><td>長野県</td><td>ぶっかけ・ルー攻め派</td></tr>
<tr><td>42</td><td>上野 ひろみ</td><td>うえの ひろみ</td><td>女</td><td>2016/6/14</td><td>B型</td><td>大分県</td><td>左ルー・混ぜ混ぜ派</td></tr>
<tr><td>43</td><td>沢田 小百合</td><td>さわだ さゆり</td><td>女</td><td>2017/5/11</td><td>O型</td><td>東京都</td><td>左ルー・ルー攻め派</td></tr>
<tr><td>44</td><td>島 明宏</td><td>しま あきひろ</td><td>男</td><td>2016/6/11</td><td>O型</td><td>神奈川県</td><td>左ルー・せき止め派</td></tr>
<tr><td>45</td><td>手塚 ケンイチ</td><td>てづか けんいち</td><td>男</td><td>2016/5/28</td><td>AB型</td><td>福岡県</td><td>手前ルー・せき止め派</td></tr>
<tr><td>46</td><td>玉田 憲史</td><td>たまだ のりひと</td><td>男</td><td>2016/5/23</td><td>O型</td><td>愛知県</td><td>奥ルー・ルー攻め派</td></tr>
<tr><td>47</td><td>小野田 勇一</td><td>おのだ ゆういち</td><td>男</td><td>2016/7/8</td><td>O型</td><td>山口県</td><td>奥ルー・別口派</td></tr>
<tr><td>48</td><td>中井 扶樹</td><td>なかい もとき</td><td>男</td><td>2017/3/28</td><td>B型</td><td>岡山県</td><td>ぶっかけ・ルー攻め派</td></tr>
<tr><td>49</td><td>池田 あや子</td><td>いけだ あやこ</td><td>女</td><td>2016/9/26</td><td>B型</td><td>埼玉県</td><td>奥ルー・ルー攻め派</td></tr>
<tr><td>50</td><td>黒谷 寿々花</td><td>くろたに すずか</td><td>女</td><td>2016/5/30</td><td>B型</td><td>福岡県</td><td>ぶっかけ・せき止め派</td></tr>
</tbody>
</table>
</body>
</html>
.search-area {
width: 700px;
margin: 10px auto;
}
.search-area select {
padding: 4px;
vertical-align: middle;
}
#data {
width: 700px;
margin: 20px auto;
border: 1px solid #CCC;
border-collapse: collapse;
font-size: 14px;
}
#data th,
#data td {
padding: 0 4px;
border: 1px solid #CCC;
}
$(function(){
$("#button").bind("click",function(){
var abc , def;
abc = $("#birth").val();
def = $("#blood").val();
re = new RegExp(abc);
re2 = new RegExp(def);
$("#data tbody tr").each(function(){
var txt = $(this).find("td").text();
if(txt.match(re) != null){
if(txt.match(re2) != null){
$(this).show();
}else{
$(this).hide();
}
}else{
$(this).hide();
}
});
});
$("#button2").bind("click",function(){
$("#data tr").show();
});
});
Also see: Tab Triggers