Making a TD clickable

前端 未结 7 619
有刺的猬
有刺的猬 2020-12-09 03:41

I\'ve set up a fiddle with a table.

You see, Im trying to make a table where the user will hover and click the td to show an id. Check the fiddle out and you\'ll und

7条回答
  •  再見小時候
    2020-12-09 04:21

    Just wanted to add two ways that actually worked inside the for me:

    1. Using Angular 5:

      a. in [yourname].component.html:

        ...
      

      b. In [yourname].component.ts: (inside your exported class.. ) simply implement the needed function..

         export class [youyname].... {
      
           ....
           myClick() {
           }
         }
      
    2. Pure JS:

        
      
      
        
    3. my cell
      Yo......

      The easiest way..

      (Note: It's possible to put the script inside the tag, or even load an external JS file inside it, but I don't like doing it like that.)

      提交回复
      热议问题