

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Getting values from HTML5 Canvas to JavaScript
When we draw anything on Canvas, it keeps no memory of anything that was drawn. While drawing we need to keep track of all the necessary information yourself as we draw. Therefore, it is not feasible to get value from HTML5 canvas to JavaScript as it keeps no memory. It just draws like this −
<canvas id = "myCanvas" height = "300" width = "500" style = "border:2px solid #808080;"></canvas>
On adding a function for button and clicking on it, you won’t be able to get what you want −
<div> <input type = "button" value = "Submit" onclick = "submit()"> </div>
You will not be able to get those values from the canvas since the canvas is just a bitmap.
- Related Questions & Answers
- Translating HTML5 canvas
- HTML5 Canvas distorted
- HTML5 Canvas Transformation
- Can the HTML5 Canvas element be created from the Canvas constructor?
- Load image from url and draw to HTML5 Canvas
- HTML5 Canvas to PNG File
- HTML5 Canvas fit to window
- HTML5 Canvas Transformation Matrix
- HTML5 Canvas Circle Text
- HTML5 Canvas Degree Symbol
- Zoom HTML5 Canvas to Mouse Cursor
- How to center canvas in HTML5?
- HTML5 Canvas Font Size Based on Canvas Size
- Drawing an image from a data URL to a HTML5 canvas
- Display video inside HTML5 canvas
Advertisements