Make a link unclickable for a certain amount of time

how to make parent menu unclickable in wordpress
html link not clickable
html disable email hyperlink
make link unclickable css
enable parent menu link wordpress
make link unclickable jquery
how to make parent menu clickable in wordpress
how to make a link unclickable in word

I have a link that resends an email, but I don't want to let people be able to spamclick the link.

So I figured I need to make it unclickable for 5 minutes after it has been clicked.

I found out how to disable the click function like this:

$('a').click(function(){ return false})

or this:

$('a').removeAttr('href')

But how can I make sure if it is clicked the first time, people cannot click it again for 5 more minutes? And show an alert when it is clicked in the meantime?

Can this be done with jquery?

Rather than removing the href (which can cause annoying behaviour in some browsers) - you could leverage jquery's .one to attach a disabling event handler, and then remove it 5 minutes later.

Combined with pre-defining the original event handler, we can then revert back to behaviour before we initially clicked the link.

(function($) {
    var lockLink = function() {
        var link = $(this);

        link.on('click', function(event) {
            event.preventDefault();
            return false;
        });

        window.setTimeout(function() {
            link.off();
            link.one('click', lockLink);
        }, 300000);
    };

    $('document').ready(function() {
        $('a').one('click', lockLink);
    });
})(jQuery);

Removing automatic linking in Outlook > Litmus, I have a client who wants a url text in the body of an email to be a "dead link" meaning unclickable and not link anywhere. Is there any way I can make the top links on the nav bar inactive? Basically I have created sites under the root such as . Company Info HR Team 1 Team 2. and under each of those there are sub sites which show up in the drop down. I want the top links . Company Info HR Team 1 Team 2. to be inactive.

Use the setTimeout function:

$('a').on('click', function()
{
    var href = $(this).attr('href');

    $(this).removeAttr('href');

    setTimeout(function()
    {
        $(this).attr('href', href);
        alert('can now click me')
    }, 1000 * 60 * 5); // 1000 milliseconds * 60 = minutes * 5 = 5 minutes
})

Making link unclickable in javascript - JavaScript, how do i alter my code to make “Last” link unclickable when im on pic1 and the onclick command to each link and it would very time consuming if you did. then how buttonView = true again ? because some links need to work, only inside if condition make it unclickable – user1314404 May 23 '14 at 10:00 it said btnView doesn't exist in current context. – user1314404 May 23 '14 at 10:03

You can make use of the data method to store on the element the last time it was clicked.

$('#clickme').on("click",function(e){
   let lastClicked = $(this).data("lastclicked");
   if(isNaN(lastClicked) || (new Date() - lastClicked) > (5*1000*60)){
      $(this).data("lastclicked", new Date());
       return true;
   }
   alert("You cant click for 5 minutes")
   e.preventDefault();
   return false;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#" id="clickme">Click me</a>

Href link not clickable - HTML & CSS, However, they are all un-clickable, and i have no idea why, I know they don'​t link to a specific page or url, but it should still be  Making a menu item unclickable. First, login to your site and navigate to the Menus page. In the Menus page, click on the Custom Links section on the left. The Custom Links option lets you link to any URL you want, but we’ve got a special trick instead.

It's good to give the user some visible indication that the link is disabled. Conveniently, your code can also use that indicator to determine whether the link should be disabled or not:

$('#foo').click(function() {
  var $el = $(this);
  
  if ($el.hasClass('disabled')) {
    // The link is disabled
    return false;
  } else {
    // The link is enabled; do whatever it is supposed to do here

    // ...then disable the link:
    $el.addClass('disabled');
    
    // ...and re-enable it in five seconds:
    window.setTimeout(function() {
      $el.removeClass('disabled')
    }, 5000);
  }
});
.disabled {
  /* Adjust to taste */
  cursor: default;
  text-decoration:none;
  color: #CCC;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a id="foo" href="javascript:console.log('Clicked')">Click me</a>

How to Make a Menu Item Not Clickable in WordPress, While it's a great technique for that, you can make any number of menu items unclickable, and they don't have to be top-level menu links either. Ahhmm. Of course it makes sense. Links might temporarily be unavailable or unavailable under certain conditions or time frames. Insisting it must be a link send odd. A disabled button will do the trick without all the mess. Just style it as an inline link! *Drops the mic

The most simple way to achieve your goal is to register a function and remove it after the timeout:

var disabledClick = function(){ 
    return false 
};

$('a').on( "click", disabledClick );

setTimeout(function(){
    $('a').off( "click", disabledClick );
}, 2000);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<a href="www.google.com"> ask google</a>

How to Make a Menu Link Unclickable in WordPress, Have you ever wanted to add some text your your WordPress menu without it being a link? There are plenty of times when this could come in  Links are found in nearly all web pages. Links allow users to click their way from page to page. HTML links are hyperlinks. You can click on a link and jump to another document. When you move the mouse over a link, the mouse arrow will turn into a little hand. Note: A link does not have to be text. It can be an image or any other HTML element.

Suddenly, all links in #content div are not clickable, but I don't see , Following a bunch of seemingly harmless plugin updates, I suddenly have a weird bug. All of the links in my #content section are now unclickable,  If you want to manually link to a specific time in a YouTube URL, do the following: Place your cursor on the far-right side of the video's URL. Determine the number of seconds into the video you want to link (e.g., if you want to start at the five-minute mark, you would be 300 seconds in).

Css make element unclickable, Css make element unclickable. We change the scale of the dot from 0,0 to 1,1 in a certain amount of time. In this case, you'd be left with a button that has  Used this extension to open a bunch of links on pastebin, which was helpful. But it will screw some websites with embedded content. The day after I added the extension I was doing my MOOC at courses.edx and because some time had passed I didn't figure out right away it was this extension causing the corruption of the css code.

JavaScript Links FAQ, FAQ 38 How can I have a conditional link that will work on all browsers? another page if there is no activity by the user for a certain amount of time? This needs some coding skills, unfortunately. There´s no possibility in Muse to let something disappear after a certain amount of time and no possibility to make an element not being reachable anymore after rolling it away. You may have a look at musewidgeits.com but I didn`t see anything like this so far.

Comments
  • Best solution is serverside. So you remove the href, add an onclick. If they refresh, you would need to use a cookie to hold the state.
  • You can add timestamp on href itself, and keep state in browsers storage, or do it serverside, it really depends on your scenarion and what you are trying to prevent.
  • What's to stop someone just reloading the page? Javascript is only a part solution
  • How can I use localStorage with this? I've tried it like this: localStorage.lastClicked = tpj(this).data("lastclicked"); but when I try to log the content of localstorage, it says undefined. So If I put that in my if statement, the if statement is always false because it's undefined.
  • @twan updated answer. Just checking it on jsfiddle - will update with demo