Yodfha Thungwiwatthanakul Yodfha Thungwiwatthanakul - 6 months ago 54
HTML Question

How to create textbox in canvas

I wanted to create text box inside the canvas.

HTML

<canvas id="canvas" width="200" height="50"></canvas>


JavaScript

var input = new CanvasInput({
canvas: document.getElementById('canvas')
});


when I run the file HTML not have anything.

Answer

You just simply missed the libraries CanvasInput.min.js simply download from the here and add to your code.

Sample Code:

<html>
  <title>sample</title>
  <head> 
    <script src="CanvasInput.min.js"></script>
  </head>
  <body>
    <canvas id="canvas" width="200" height="50"></canvas>
    <script>
        var input = new CanvasInput({
                     canvas: document.getElementById('canvas')
         });
    </script>
  </body>
</html>
Comments