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 6826869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:11:56+00:00 2026-05-26T22:11:56+00:00

I am working on a userscript that injects my own JS into the head

  • 0

I am working on a userscript that injects my own JS into the head (this part works). I am utilizing the site’s already in-place jQuery.

I am a moderator on a vBulletin forum. I move and close A LOT of threads. I figured it would save me insurmountable amount of time if I reduced the total number of clicks I make by 2 clicks per thread.

Using .append() I’ve added my own <td> with a “quick access” <a> tag.
What I would like to happen is for when I click the <a> tag (Close or Move) it selects the appropriate option in the thread tools form (which as far as I can tell is working the way I have it coded) and then submit the form as if I had hit the Perform Actions button.

My current code is:

$(document).ready( function() {

    var topbar = $('#threadtools').closest('tr');
    var newTool = '<td><a href="#" id="newClose" style="padding-left: 10px; padding-right: 10px;"><b>Close</b></a></td>' +
                    '<td><a href="http://google.com" id="newMove"><b>Move</b></a></td>'; // Google for testing purposes I wanted to make sure preventDefault was working
    topbar.append(newTool);

    $('#newClose').click(function() { 
        alert();
    });
    $('#newMove').click(function(event) { 
        event.preventDefault();
        //var form = $('input[name$="threadadminform"]');  // select form by name
        var button = $('input[value="Perform Action"]');   // select button by name


        var closeradio = $('#ao_oct');
        var moveradio = $('#ao_mvt');
        var copyradio = $('#ao_cpt');
        var editradio = $('#ao_edt');
        var deleteradio = $('#ao_dlt');
        var stickradio = $('#ao_sut');
        var mergeradio = $('#ao_mgt');
        var redirectradio = $('#ao_rrd');

        closeradio.removeAttr('checked');
        copyradio.removeAttr('checked');
        editradio.removeAttr('checked');
        deleteradio.removeAttr('checked');
        stickradio.removeAttr('checked');
        mergeradio.removeAttr('checked');
        redirectradio.removeAttr('checked');

        moveradio.attr('checked', 'checked');
        button.trigger();
    });
});

As you can see I am currently trying to .trigger() the submit button, this does not work.
I have also tried .submit() on the form var I declared at the top, this also does not work.

How can I get this to submit as it would if I clicked the button and take me to the next appropriate page?

  • 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-05-26T22:11:56+00:00Added an answer on May 26, 2026 at 10:11 pm

    trigger needs a minimum of event, so you need to pass button.trigger(‘click’) so that it will be able to perform the click event.

    Sample demo of what you are trying to achieve is at, take a look at two button example at the above location.

    hope this helps.

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

Sidebar

Related Questions

I can't manage to load jQuery in a Google Chrome userscript. This is how
I have a userscript (read: my Javascript on someone else's site) that allows users
Working against jQuery 1.3.2 I'm looking for best practices that implement the typical '
Im writing Userscript for one page. It is working under chrome. On that page
I'm currently working on a userscript with jquery, which calls https requests on a
I have userscript. I recentyly added jquery to it. Before I added jquery that
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project that parses a log of events, and then updates a
I'm working on a project that requires my user script be run on pages
So I'm working on a Greasemonkey UserScript for Clients From Hell http://clientsfromhell.net/ and I'm

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.