/ LJCJSCodeDoc / LJCCommonLib / LJC / EventTextRows


Parameters
event - A DOM event object.

Syntax

JavaScript
static EventTextRows(event)

Sets the textarea rows for newlines.

Example

JavaScript
<body>
  <!-- The dialog for debug or other display text. -->
  <dialog id="textDialog"
    style="border: none; padding: 0px">
    <textarea id="textArea" rows="25" cols="80" autocorrect="off"
      autocapitalize="off" spellcheck="false" readonly
      style="border: none; padding: 10px">
    </textarea>
  </dialog>
</body>

// Sets the textarea rows for newlines.
EventTextRows()
{
  const elementID = "textArea";
  const eventName = "keydown";
  const handler = this.IsEnterHandler.bind(this);
  LJC.AddEvent(elementID, eventName, handler);

  // Enter
  let eventOptions = {
    key: "Enter",
    code: "Enter",
    ctrlKey: false,
    shiftKey: false,
    altKey: false,
    metaKey: false,
    repeat: false,
    bubbles: true,
  };
  let keyDownEvent = new KeyboardEvent(eventName, eventOptions);
  this.CompareValue = true;
  textArea.dispatchEvent(keyDownEvent);

  textArea.removeEventListener(eventName, handler);
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.