Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7743571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:34:10+00:00 2026-06-01T09:34:10+00:00

I have been playing about with canvas, but have stumbled across a problem. When

  • 0

I have been playing about with canvas, but have stumbled across a problem. When reading up on canvas I found a few different ways to declare the canvas and it’s context, both seemed to work until I tried implementing a simple frame buffer.

function drawToCanvas(){
    var buffer = $("#myBuffer");    
    var canvas = $("#myCanvas");
    var bufferContext = buffer.get(0).getContext("2d");
    var context = canvas.get(0).getContext("2d");

    //var buffer = document.getElementById("myBuffer"); 
    //var canvas = document.getElementById("myCanvas");
    //var bufferContext = buffer.getContext("2d");
    //var context = canvas.getContext("2d");

    bufferContext.fillRect(100,100,100,100);
    context.drawImage(buffer, 0, 0);
}

If I use the commented out lines to draw the buffer image to the context it works perfectly. However if I use the above lines the drawImage() function gives a typeError. This was confusing me considering I was able to use the JQuery selector method fine, it was just the drawImage() function failing me.

Any advice would be really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:34:11+00:00Added an answer on June 1, 2026 at 9:34 am

    When using the jquery selectors, the buffer parameter used in drawImage is the jquery object, i guess. You should probably change it to buffer.get(0) ? I’ve never used jquery myself, but that’s what I infer from the rest of your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been playing about with CSS3 columns and have come across a positioning issue.
I have been playing around with a few ways to batch insert a list
I have been playing with setting up different relationships for a few hours now
I have been playing about with a GUI today and trying add different elements
I've been playing about with Runnable s and have discovered that if you postDelayed
I am currently learning about basic networking in java. I have been playing around
I have been playing with this one for a few days now, and keep
I'm have been playing around with linq this morning and have a questions about
I'm just starting out with unit testing in C#. I have been reading about
I have been playing around with JavaScript and Canvas for a while. Very often

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.