javascript - How to click on a certain row in the table and then the corresponding attribute value in the table will appear on the form?
巴扎黑2017-07-05 11:01:39
0
5
1366
As shown in the picture above, how can I click on a certain row in the table and then the corresponding attribute value in the table will appear at 2 places. .
You can request all the data back when generating the form, put it on tr through data-*, and then bind the click event to tr. When you click, fill in the data on tr to the corresponding place, which can reduce requests. Number of times (the sequelae of doing too much on the mobile terminal haha
Delegation
Using
delegate
you don’t need to consider whether the objects inside are loaded asynchronouslyThe tr of the form is bound to the click event. When clicked, the values required by the form are obtained and filled in sequentially.
You can request all the data back when generating the form, put it on tr through data-*, and then bind the click event to tr. When you click, fill in the data on tr to the corresponding place, which can reduce requests. Number of times (the sequelae of doing too much on the mobile terminal haha
Click in a loop to get the attributes of each row, then write the attributes to Figure 2 and enter the corresponding value