I have the following JavaScript object:
function Project(name)
{
this.panel = $('#worksheet_panel');
this.name = name;
this.workBox =
'<div class="worksheet_box">'+
' <div class="list-group">'+
' <button class="btn btn-block btn-primary btn_work_add" onclick="setProject('+this.name+');" data-toggle="modal" data-target=".workModal">Add</button>'+
' </div>'+
'</div>'+
'</div>';
function changeName(name)
{
this.name = name;
}
this.addElement = function()
{
this.element =
'<div id="1" class="col-md-3 table-bordered worksheet_overall_box" draggable="true" ondragstart="drag(event)">'+
'<div class="table-bordered title_box">'+
'<h4 class="title text-center worksheet_title">'+name+'</h4>'+
'</div>'+
this.workBox;
this.panel.append(this.element);
}
}
Now as you can see the this.workbox has an onclick function that calls this function:
function setProject(name) {
selected_project = projects[name];
}
Now when ever I click the button I get the following error:
ReferenceError: asasa is not defined
setProject(asasa);