Have no background in any sort of coding at all, but just need to modify this script and I’d be all set. What I’d like it to do is similar, but with email addresses and only one field, this is what I get when I right click the form then inspect element. Thank you.
input title="Email Address" type="text" name="login" id="login" class="event_reg_field" value="" onkeypress="return checkSubmit(event, regFormSubmit)" aria-required="true" required="true"
Script that needs modifying
Would it be as simple as this? I’m guessing the array names don’t matter much as long as it stays consistent.
// Define the arrays
var aColors = ['abc@email', 'xyz@email', 'qrs@email'];
var aFields = ['[name="login"]'];
// Fill with a random color from aColors
var nColorIdx = Math.floor(Math.random()*aColors.length);
document.querySelector(aFields[i]).value = aColors[nColorIdx];
// Remove used color from aColors
// Exit when there are no more colors
if (!aColors.length) break; }
Here’s my updated version with help from other sites, it works, but it seems to still use a value again, which I do not want. I just want it to use it once, then remove it from the list.
// Define the variables
var emails = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
var eField = ['[name="login"]'];
// Fill in with random email from emails
var emailIndex = Math.floor(Math.random() * emails.length); document.querySelector(eField).value = emails[emailIndex];
// Remove used email from emails
Edit - I ended up paying someone on Fiverr to help me.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (
</>) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.