Categories

How to make any link not clickable

Phil Nowak August 3, 2012
Rating: 3.8/5. From 4 votes.
Please wait...

Sometimes you may need to lock some link, for example you do not pant one of your blog posts to open anything, but you still want others to work properly. In this case you will need to embed jQuery scripting to lock button link.

In this tutorial you will learn the way to lock any button with jQuery, you can use this method anywhere in the web. Note that this method works cross browser and it is extremely useful for CMS systems when you can’t add some structural changes via files.

  1. Open your template and locate link you want to stop working and find out exact path by elements (you may use Firebug or any other web developing plugin to locate exact location of your link, you may also view website structure to find it out), e.g:
    	.K2ItemsRow .itemContainer .catItemView .catItemHeader .catItemTitle a
    This is regular CSS path, you are using same selectors for CSS styling.
  2. When you know proper selectors you need to open your index.html file (HTML templates) or and other file to add jQuery and paste similar script:
    				<script>
    				jQuery(document).ready(function(){
    	                           jQuery('.K2ItemsRow .itemContainer .catItemView .catItemHeader .catItemTitle a').click(function(){
        	                              return false; // prevents default action
                              	    });
                                    });
    				</script>
    				

    As you can see we’ve used our previous example as link selector, but you will need to replace with your link details:

    	.K2ItemsRow .itemContainer .catItemView .catItemHeader .catItemTitle a

    Usually you can paste this scripting everywhere in the template but some CMS systems may block the scripting in case you paste it in the incorrect place so If you have any problems using this scripting please contact us.

  3.  

This entry was posted in JS Animated tutorials and tagged action, clickable, link, remove. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket