function add_widget()
{
gridster.add_widget('<li style="background-color: black; list-style: none;" data-content=""><button onclick="remove_widget(event);">Remove Box</button><button onclick="edit(event);">Edit</button></li>');
save();
}
function remove_widget(e)
{
e.srcElement.parentNode.setAttribute("id", "remove_box");
gridster.remove_widget($('.gridster li#remove_box'));
save();
e.preventDefault();
}
添加和删除功能可以正常工作,但是我无法进行编辑,这是我的代码
function edit(e)
{
currently_editing = e.srcElement.parentNode.getAttribute("data-content");
document.getElementById("gridster_edit").value = decodeURIComponent(currently_editing);
e.preventDefault();
}