Hello everyone. I am a little nervous when I ask a question for the first time. I hope to make progress together with you. The problem is that I traverse a group of img and want to obtain the subscript of the currently clicked img. I added a num attribute to img to get the key of this element, how can I obtain the num of the current img? {Code...
Hello everyone. I am a little nervous when I ask a question for the first time. I hope to make progress together with you. The problem is that I traverse a group of img and want to obtain the subscript of the currently clicked img. I added a num attribute to img to get the key of this element, how can I obtain the num of the current img?
{Foreach from = $ answers item = item key = key} {/foreach} This is the img of traversal
// Print the current element function selectImg (a) {console. log ()}
I again use the console. log (this. num) as undefined, and all the methods have been used. I don't know how to get it now. please kindly advise.
Reply content:
Hello everyone. I am a little nervous when I ask a question for the first time. I hope to make progress together with you. The problem is that I traverse a group of img and want to obtain the subscript of the currently clicked img. I added a num attribute to img to get the key of this element, how can I obtain the num of the current img?
{Foreach from = $ answers item = item key = key} {/foreach} This is the img of traversal
// Print the current element function selectImg (a) {console. log ()}
I again use the console. log (this. num) as undefined, and all the methods have been used. I don't know how to get it now. please kindly advise.