Home>

Moving sample


. txt-area {
  outline: none;
  user-select: text;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  background: lightgray;
  line-height: 30px;
  font-size: 20px;
  max-height: 90px;
  width: 400px;
  border: 2px solid;
  border-color: # 1da1f2;
  overflow-y: scroll
}
var tBox = document.getElementById ("dmComposerTextInput");
  tBox.addEventListener ('input', function () {
    if (tBox.innerText.length>3) {
        // TODO: There is no effect on the operation, but it is an error, so it needs to be corrected when there is time.
        tBox.prop ("contenteditable", false);
    }
  });
Troubleshooting

When you start typing text, an error like the title is displayed.
I'm having trouble understanding the cause.
There is no effect on the intended operation, but I think that an error has occurred for some reason, so I want to do something.

  • Answer # 1

    Are you mistaken for jQuery?

    【. prop () | jQuery API Documentation】
    https://api.jquery.com/prop/

    tBox.contenteditable = false;

    [HTMLElement.contentEditable-Web API | MDN]
    https://developer.mozilla.org/en/docs/Web/API/HTMLElement/contentEditable

Related articles