How it works:
The code given below will automate the process of amazon signup once you put it inside the web console, with all the values like name, email being picked automatically from the code and then you can edit the phone number section manually and then the password similarly.
The above code is divided into four sections(1-4) with each doing different things.
The first section is about creating a DOM element which we name as ‘script’ and then set the ‘type’ and ‘src’ of this element using the DOM setAttribute() method which adds the specific attribute to an element, and gives it the specified value. This element is basically the script which we are trying to run(jQuery code) and in the last line of this section, we append this element into the DOM body.
The second code section contains two arrays ‘nameArr’ and ’emailArr’ which contains several names and emails which we can iterate over and randomly choose values from. These randomly choosen magic takes place in code section 3, while the assigning to the DOM in code section 4.
In the last code section, we are basically assigning values to the DOM elements that we extract using the JQuery ‘$’ sign which demands a selector inside it and then it performs some action on it. Here we are just selecting and assigning values and then finally a setTimeout() method.
- How to auto-resize an image to fit a div container using CSS?
- CSS | grid-auto-flow Property
- CSS | grid-auto-columns Property
- CSS | grid-auto-rows Property
- HTML | script Tag
- HTML | DOM Script src Property
- HTML | <script> src Attribute
- HTML | DOM Script Object
- HTML | DOM Script async Property
- Measuring script execution time in PHP
- HTML | <script> type Attribute
- Create a web server and run PHP script on it using Raspberry Pi
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.