I have the following code which is drawing a canvas on each element on the page but it is in a CMS and the elements are being added dynamically which means that the element is not always there when JQuery parses the DOM. My error says "ctx is not defined" but it does render some of the canvas elements so I know it is defined at some points.
I know I am supposed to use live() or delegate but I have only done it with click handlers before and I'm not sure of the exact syntax in this instance. Can anyone help me?
ctx = $(this).find('.html5_price');
var element = ctx.get(0);