エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
onClick Function "this" Returns Window Object
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
onClick Function "this" Returns Window Object
I've come across a head scratching issue with my JavaScript application. If I write an element li... I've come across a head scratching issue with my JavaScript application. If I write an element like this: <li onClick="alert(this.tagName)"></li> I get "LI." However if I do this: <li onClick="foo()"></li> Where "foo()" is: function foo(){ alert(this.tagName); } I get "undefined." I am away how "this" is supposed to work in regards to attached functions. But, I am baffled because "this" is not pic

