Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7858603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:31:32+00:00 2026-06-02T21:31:32+00:00

This website has a gallery of images. Each time I click on a thumbnail

  • 0

This website has a gallery of images. Each time I click on a thumbnail image it opens the URL in a new tab (not because I set firefox to open links in new tabs). I want to just open the URL in the same window. An example of what the thumbnail images looks like is this.

<span class="thumb" id="789">
<a href="/post/image/12345" onclick="return PostMenu.click(12345)">
<img  class="preview" src="http://abc.com/image.jpg" title="title" alt="">
</a>
</span>

I believe that onclick="return PostMenu.click(12345)" is doing this. How can I replace the PostMenu.click() function with my own empty function in GreaseMonkey? Is there a way to make a GreaseMonkey script intercept all onclick events?

My only other option is to go through all the span classes and remove the onclick="return PostMenu.click(12345)" from the link tags. But since there can be over a hundred of these on a single page, I’d rather not do that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:31:33+00:00Added an answer on June 2, 2026 at 9:31 pm

    Actually, deleting the onclicks is not at all an onerous task.

    With jQuery, the code would merely be:

    $("span.thumb a").prop ("onclick", null);
    

    Or, for older versions of jQuery:

    $("span.thumb a").removeAttr ("onclick");
    

    A complete script:

    // ==UserScript==
    // @name     _Kill select onClicks
    // @include  http://YOUR_SERVER/YOUR_PATH/*
    // @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
    // ==/UserScript==
    
    $("span.thumb a").prop ("onclick", null);
    

    The advantage of this approach is that:
    (1) You preserve PostMenu.click() in case you want it, or it’s needed, elsewhere,
    (2) You are removing crud from the page, which makes it just a little bit less unwieldy.
    (3) I suspect that you might also need to unwrap or modify that link — in which case, the targeted rewrite approach using jQuery is the way to go.


    If you really just want to replace the PostMenu.click() function with your own empty function, the code for that is just:

    unsafeWindow.PostMenu.click = function () {};
    

    As for having Greasemonkey intercept all onclick events… That is not easy to do reliably. Forget that approach unless there is an overwhelming need for some reason (which there doesn’t seem to be, in this case).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this website http://wedessertmore.com that has some forms popup when you click on
I'm currently in charge of this illustration website with an image-gallery which was working
I am developing a component for Joomla website. This website has a sophisticated template
I have a weird situation. A client of mine has a website having this
I was creating a website http://tapasya.co.in and i found that this site has some
use this website a lot but first time posting. My program creates a number
A website I recently completed with a friend has a gallery where one can
I want to apply this jQuery http://jsfiddle.net/awaises/9tFLK/ on the gallery. My friend has developed
How can i do round corners like this website has in some places.. I
So I have an image gallery website organized in albums and so the db

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.