user10112919
user10112919

Reputation:

How to disable link on images google custom search engine cse?

I'm using Google custom search engine cse (free version) and I want to disable link on images results, because I want to show pop-up images on click, someone can help me, how I can disable the link on images on Google custom search engine?

I tried

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript" language="javascript">
    $(document).ready(function() {
      $('.gs-image-box').bind('click', false);
    }); 
    </script>

but this is not working.

Upvotes: 2

Views: 183

Answers (1)

Lasithe
Lasithe

Reputation: 2770

$(".gs-image-box").click(function(event){
    event.preventDefault(); // This will prevent a link from opening the URL

    // your popup code
});

Upvotes: 1

Related Questions