LoginSignup
2
2

More than 5 years have passed since last update.

Knockout.jsでイベントが発生しているタグを取得する

Posted at

knockout.jsでイベント発生のタグを意識する必要がある場合、第二引数まで指定してやれば取得できます。

class ViewModel
  func_1: (item,event)=>
    me = $(event.currentTarget)
    # イベントが発生しているタグのvalueを表示
    alert(me.attr('value'))

viewとの結合が強くなるからあまり推奨されていないんだろうな。。。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2