LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Tuesday, January 21, 2020

選択した要素のタグ名を取得してみる(document.activeElement.tagName)


document.activeElement.tagName
で取得できる。


デモ





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




index.html
<!DOCTYPE html>
<html>
<body>
  <input type="text">
  <textarea></textarea>
  <button>button</button>
<script>
document.onclick = clicked;

function clicked() {
  var tag = document.activeElement.tagName;
  alert(tag);
}

</script>
</body>
</html>



Latest post

スプレッドシートA列にある複数のテキストをスライドに追加したい(Google Apps Script)

今回Google Apps Scriptでやりたいこと GoogleスプレッドシートA列にある複数の値を取得して Googleスライドに渡して 図形オブジェクトのテキストとして追加したい ① スプレッドシートのA列に値を入れておく ② Code.gsのinsertNewShape...