Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to select a radio then submit form with jQuery in vBulletin?
    primarykey
    data
    text
    <p>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.</p> <p>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. </p> <p>Using <code>.append()</code> I've added my own <code>&lt;td&gt;</code> with a "quick access" <code>&lt;a&gt;</code> tag.<br> What I would like to happen is for when I click the <code>&lt;a&gt;</code> 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.</p> <p>My current code is:</p> <pre><code>$(document).ready( function() { var topbar = $('#threadtools').closest('tr'); var newTool = '&lt;td&gt;&lt;a href="#" id="newClose" style="padding-left: 10px; padding-right: 10px;"&gt;&lt;b&gt;Close&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;' + '&lt;td&gt;&lt;a href="http://google.com" id="newMove"&gt;&lt;b&gt;Move&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;'; // 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(); }); }); </code></pre> <p>As you can see I am currently trying to <code>.trigger()</code> the submit button, this does not work.<br> I have also tried <code>.submit()</code> on the form var I declared at the top, this also does not work.</p> <p>How can I get this to submit as it would if I clicked the button and take me to the next appropriate page?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload