📌  相关文章
📜  获取 id 按钮单击反应 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:10.355000             🧑  作者: Mango

代码示例1
class Button extends React.Component {

  handleId = (e) => {
   /*Well if the elements are nested event.target won't always work
     since it refers to the target that triggers the event in the first place.*/
    console.log(e.target.id);
    console.log(e.currentTarget.id);
  }

  render() {
    return (
      
    );
  }
}