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();
        }

The add and remove functions work fine but I can't get the edit to work, here is my code

function edit(e)
        {
            currently_editing = e.srcElement.parentNode.getAttribute("data-content");
            document.getElementById("gridster_edit").value = decodeURIComponent(currently_editing);
            e.preventDefault();
        }

0 Answers