q5play
    Preparing search index...

    Function createInput

    • 📑 Creates an input element.

      Use the value property to get or set the input's value.

      Use the placeholder property to set label text that appears inside the input when it's empty.

      See MDN's input documentation for the full list of input types.

      Parameters

      • Optionalvalue: string

        initial value

      • Optionaltype: string

        text input type, can be 'text', 'password', 'email', 'number', 'range', 'search', 'tel', 'url'

      Returns HTMLInputElement

      await Canvas(200, 100);
      textSize(64);

      let input = createInput();
      input.placeholder = 'Type here!';
      input.size(200, 32);

      input.addEventListener('input', () => {
      background('orange');
      text(input.value, -90, 30);
      });