2. Then add some simple html. This is mainly to add two A links in a div. Div and A links have their own id attributes, an action button, and an onclick event.
3. Add the corresponding click event function.
4. In the function, first use the selector method of jquery to get the link of A, and the code $ ("# my _ div a") refers to all the links of A whose id is my _ div.
5. After obtaining the links, we use a for loop to obtain the id of all the links in the div, mainly through the attr method of jquery to obtain the id attribute of each linked control. When you get it, save it in the array.
6. Then, the id of all links will pop up through the alert method.
7. Run the page. You can see that there are two links now. Click the button.
8. After clicking, an early warning window will pop up, showing the id attributes of two links. Compared with the values in the specification, the results obtained are correct.