
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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.
Advertisements