Languages

Menu
Sites
Language
Can Any one Solved.

I have a many button ex:- button 1  2  3  4  5  6  7   8   9    10.

In Every button click  create a different different canvas and also diff. size of canvas on same page.

if U click 1 then one canvas is created

if U click 2 then two canvas is created  and so on.

but my problem is not to create every time new canvas here canvas is overwite. i have used

$('#canvas1').remove();   
$('#canvas').detach(); 

so how can solved it.

Responses

5 Replies
AVSukhov

Hello,

Could you please provide more code samples (creating canvas and deleting)?

 

Palitsyna

Hello,

share more details, please. Do you want to delete old canvas and create new or you just want to hide canvas and then show it again? 

Vikram

I think he want to using another canvas to cover original. And original is removed.

colin Rao

Hi,

Not clear your purpose. Could be more details or share your sample code here.

If you want to reuse the canvas previous created, just keep the canvas id is same, if you want to create new canvas every time, please make sure the new canvas with a new(diferent) id. 

colin Rao

Hi,

Seems you want to remove the previous canvas and create a new canvas every time while click on buttons, right?

But, as the jquery api, seems the remove() and detach() won't delete the element, just remove it form the html document. I thinks that's the root cause of your problem. 

Suggest to create an new canvas element with a different id every time. Or, just re-use the canvas and empty its content/state every time while click on buttons.