Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


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


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.


Save Automatically?

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.


                <div class="flex flex-col">
  <form class="flex m-4 flex-row flex-wrap" autocomplete="off">
    <label for="prefecture-code" class="mr-3 flex-grow md:flex-grow-0 w-full md:w-auto md:h-7">都道府県</label>
    <select id="prefecture-code" class="rounded-md border border-gray-300 flex-grow w-full h-10 mt-3 md:flex-grow-0 md:w-auto  md:w-8 md:h-7 md:mt-0 md:rounded-sm" type="text" name="postal-code" maxlength="7">
<option value="01">北海道</option>
<option value="02">青森県</option>
<option value="03">岩手県</option>
<option value="04">宮城県</option>
<option value="05">秋田県</option>
<option value="06">山形県</option>
<option value="07">福島県</option>
<option value="08">茨城県</option>
<option value="09">栃木県</option>
<option value="10">群馬県</option>
<option value="11">埼玉県</option>
<option value="12">千葉県</option>
<option value="13">東京都</option>
<option value="14">神奈川県</option>
<option value="15">新潟県</option>
<option value="16">富山県</option>
<option value="17">石川県</option>
<option value="18">福井県</option>
<option value="19">山梨県</option>
<option value="20">長野県</option>
<option value="21">岐阜県</option>
<option value="22">静岡県</option>
<option value="23">愛知県</option>
<option value="24">三重県</option>
<option value="25">滋賀県</option>
<option value="26">京都府</option>
<option value="27">大阪府</option>
<option value="28">兵庫県</option>
<option value="29">奈良県</option>
<option value="30">和歌山県</option>
<option value="31">鳥取県</option>
<option value="32">島根県</option>
<option value="33">岡山県</option>
<option value="34">広島県</option>
<option value="35">山口県</option>
<option value="36">徳島県</option>
<option value="37">香川県</option>
<option value="38">愛媛県</option>
<option value="39">高知県</option>
<option value="40">福岡県</option>
<option value="41">佐賀県</option>
<option value="42">長崎県</option>
<option value="43">熊本県</option>
<option value="44">大分県</option>
<option value="45">宮崎県</option>
<option value="46">鹿児島県</option>
<option value="47">沖縄県</option>
    <button type="submit" class="flex-grow px-4 py-2 mr-2 mt-3 rounded-md md:flex-grow-0 md:h-7 md:mr-0 md:mt-0 md:py-0 md:rounded-sm bg-indigo-600 text-white">検索</button>
<main class="flex md:flex-row flex-col-reverse">
  <article class="flex-grow-1 lg:w-1/2 mx-4">
    <table class="table-auto w-full mb-4 metadata">
        <tr class="data-version">
          <th class="border border-indigo-300 bg-indigo-500 text-white p-2 w-1/3">データのバージョン</th>
          <td class="border border-indigo-300 p-2 w-2/3"><span>(ここに結果が表示されます)</span></td>
    <div id="results">
      <ul class="list-disc list-inside inner"></ul>




                const form = document.querySelector("form");
const prefectureCodeField = form.querySelector("#prefecture-code");

const getPrefectureCode  = () => {
  return prefectureCodeField.value;

const kenallApi = new kenall.KENALL("f32fcf25cc2f0c924d96a96f5f2de415bb7f6332");

const fillText = (anchor, field, text) => {
  anchor.querySelector(`.${field} span`).innerText = text;

const metadataTable = document.querySelector("table.metadata");
const resultTableTemplate = document.querySelector("table.result.template");
const resultsElement = document.querySelector("#results");
const resultsElementInner = resultsElement.querySelector(".inner");

form.addEventListener("submit", async (e) => {
  const prefectureCode = getPrefectureCode();
  if (prefectureCode === "") {
  let data = undefined;
  try {
    data = await kenallApi.getCities(prefectureCode);
  } catch (e) {
    if (e.status === 404) {
      fillText(metadataTable, "data-version", "データが見つかりませんでした");
    } else {
      alert(`API呼び出しに失敗しました (ステータス ${e.status}})`);
  fillText(metadataTable, "data-version", data.version); => {
    const li = document.createElement("li");
    li.innerText = `${} (${entry.city_kana})`;
  location.href = `#${}`;
  return false;

const reset = () => {
  ["data-version"].forEach((field) =>
    fillText(metadataTable, field, "(ここに結果が表示されます)")

  for (let i = resultsElementInner.childNodes.length; --i >= 0; ) {