Organizational Research By

Surprising Reserch Topic

only want a link to be able to be clicked once

only want a link to be able to be clicked once  using -'jsp,hyperlink,click,onsubmit'

I have a link that opens a new page and I was wondering if there was a way that would make the link only click-able once so the form cannot be submitted numerous times.

<div id="addSection"><a class="addSection"
    onclick="javascript:writeBookmark(this); var newwin ='<c:url value="/URL_WINDOW"/>',
    'additional', 'width=400,height=280,toolbar=no,,menubar=no,scrollbars=yes,resizeable=no'); newwin.focus(); return null;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    Add sub

I have JavaScript to do this with buttons but not sure how to do it when I am not dealing with buttons.

asked Oct 19, 2015 by kotmus2002
0 votes

Related Hot Questions

1 Answer

0 votes

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) {
    var newwin ='', 
    $(this).off('click').on('click', function() {
        alert('You've already performed this action');
answered Oct 19, 2015 by r3tt