Only want a link to be able to be clicked once

偶尔善良 提交于 2019-12-02 10:00:50

First, I would move your click handler so that it's not applied inline. Then, I would add some code to the handler to either remove the link itself or replace the click handler with one that pops up a message that the link can only be used once.

Example (using jQuery)

$('.addSection').on('click', function(e) {
    e.preventDefault();
    writeBookmark(this);
    var newwin = window.open('<c:url value="/URL_WINDOW"/>', 
                             'additional',
                             'width=400,height=280,toolbar=no,,menubar=no,scrollbars=yes,resizeable=no');
    newwin.focus();
    $(this).off('click').on('click', function() {
        alert('You've already performed this action');
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!