如何在Wordpress中编辑gridster小部件框?

时间:2019-05-03 13:00:47

标签: wordpress gridster

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

0 个答案:

没有答案