LANG SELRCT

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

Monday, August 20, 2018

要素の中身を編集可能にしたい contenteditable=true


このように書くとdiv要素の中身を編集可能にできる

<div contenteditable=true>edit here</div>


デモ
edit here



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




index.html
<!DOCTYPE html>
<html>
<body>
  <div contenteditable=true>edit here</div>
</body>
</html>

意訳
 


編集可能なdiv要素





補足


JSで指定したいときはsetAttributeでこのように↓

ELEMENT.setAttribute("contenteditable", true);



参考

HTMLElement.contentEditable
https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/contentEditable

Latest post

Extracting data from Google Sheets with regular expressions

Introduction Regular expressions are a powerful tool that can be used to extract data from text.  In Google Sheets, regular expressions ca...