The current element as its Event function param

后端 未结 3 1506
無奈伤痛
無奈伤痛 2020-11-30 10:10

I\'ve got an element


On this, there is an Event

onChange=\"myfunction(param)\".
3条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 11:14

    Inside an inline event handler, this will refer to the DOM element.

    Therefore, you can write onchange="myfunction(this)" to pass the DOM element itself to the function.

提交回复
热议问题