For A9's Pearls Sequin Stud What I wanted it to do: Mark yes for pearl if I pressed 1 yes for sequin if I pressed 2 yes for stud if I pressed 3 It's currently only clicking the yes radio button for pearl and not working for sequin or stud. Spoiler: Code Code: $(document).ready(function() { $('[name="pearl"]').focus(); $(this).keydown(function(e) { if (e.keyCode == 49) { $('input[name="pearl"][value="YesPearl"]').click(); } }); }); $(this).keydown(function(e) { if (e.keyCode == 50) { $('input[name="sequinl"][value="YesSequin"]').click(); } }); $(this).keydown(function(e) { if (e.keyCode == 51) { $('input[name="stud"][value="YesStud"]').click(); } }); $('input[value="NoPearl"]').click(); $('input[value="NoSequin"]').click(); $('input[value="NoStud"]').click(); $(document).keyup(function(event) { if(event.which == 13){ event.preventDefault(); $("#submitButton").click(); } });
Fixed. I cleaned it up. There were too many braces, I just needed to wrap it up in one set. Even though I have an @ require I added the first line to get rid of the $(jQuery) is not defined error in tampermonkey. Spoiler: Code Code: var $ = window.jQuery; $(document).ready(function() { $('input[value="NoPuffy"]').click(); $('input[value="NoButton"]').click(); $('[name="puffy"]').focus(); $(this).keydown(function(e) { if (e.keyCode == 50) { $('input[name="button"][value="YesButton"]').click(); } }); $(this).keydown(function(e) { if (e.keyCode == 49) { $('input[name="puffy"][value="YesPuffy"]').click(); } }); }); And here's a fiddle with the HIT.