I have calendar constructor function and two prototype functions in first prototype function I am creating div element and creating it's attribute ondragstart and I want to call another prototype function on in it's second argument var that = this; that.drag(event), but when it renders it shows <div ondragstart="that.drag(event)"> console gives error that is not function. How can I call prototype function in this situation? please explain with example, thanks.
calendar.prototype.tbl = function(){
var that = this;
var evDiv = document.createElement('div');
evDiv.setAttribute('draggable', 'true');
evDiv.setAttribute('ondragstart', 'that.drag(event)');
}
calendar.prototype.drag = function(ev){
ev.dataTransfer.setData("text", ev.target.id);
}
setAttribute. Do not use event listener attributes. Do not use code inside strings.on). Use event listeners.