2021年1月15日星期五

Javascript - HTML / Is this possible?

Is it possible to use 'this' in this scenario?

for (var i = 0; i<td.length; i++){      td[i].onclick = cambiarColor(this.id);  };  

What Im trying to do here is assign the same 'onclick' function to all my elements. And making the elements send their id when clicking on them.

https://stackoverflow.com/questions/65745850/javascript-html-is-this-possible January 16, 2021 at 10:13AM

没有评论:

发表评论