Apps Scriptリファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2019年11月20日水曜日

テキストエリアが空になったらアラートを出したい



デモ




コード.gs
function doGet() {
  return HtmlService.createHtmlOutputFromFile("index");
}
意訳
この機能がやること
指定したHTMLファイルを表示する




index.html
<!DOCTYPE html>
<html>
  <body>
    <textarea id="ta">テキスト</textarea>
    <script>      
      document.getElementById('ta').onkeyup = taKeyup;

      function taKeyup() {
        console.log("changed!");
        if(document.getElementById('ta').value === "") {
          alert("blank");
        }
      }
      
    </script>
  </body>
</html>




Latest post

スプレッドシートの空白セルを直前の値で埋めたい

A列の空白セルに直前の値を入れたくて書いたコードです スプレッドシートに以下のようなBeforeの表があるとき (A列に空白セルがある) Before 1 A B 2 エリア 都市 3 東京 新宿 4 渋谷 5 池袋 6 神奈川 横浜 7 川崎 8 相模原 9 千葉 千葉 10 ...