- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I alter the color of an HTML5 canvas element using jQuery?
To alter the color of an HTML5 canvas, use −
document.getElementById("ID").style.background = red;
You can also try the following −
var ctx = canvas.getContext('2d'); ctx.fillStyle = "#FF0000"; ctx.fill();
- Related Articles
- How can I use the HTML5 canvas element in IE?
- How can I get the ID of an DOM element using jQuery?
- How can I select an element by tag name using jQuery?
- How can I show and hide an HTML element using jQuery?
- Can the HTML5 Canvas element be created from the Canvas constructor?
- How can I select an element by its class name using jQuery?
- How can I select an element by its ID attribute using jQuery?
- How can I change the text color with jQuery?
- How do I add a simple onClick event handler to an HTML5 canvas element?
- How can I select an element by name with jQuery?
- Measure text height on an HTML5 canvas element
- Change colour of an image drawn on an HTML5 canvas element.
- How can I select an element with multiple classes in jQuery?
- Print a HTML5 canvas element
- Can you take a screenshot of the page using HTML5 Canvas?