-1

I want to show code hints like: onclick, onblur..... Is there any extention that can help me do that? I tried installing tabnice,JavaScript (ES6) code snippets but look at the picture below, I typed .oncl but vs code doesn't suggest onclick as expected. enter image description here

rioV8
  • 24,506
  • 3
  • 32
  • 49
Kuj9xst3
  • 5
  • 2
  • 4
    [Don't use onclick, onblur, etc](https://developer.mozilla.org/en-US/docs/Web/Events/Event_handlers#registering_event_handlers). They're legacy functions that unfortunately cannot be removed from JS, but that you should _not_ be using anymore. Use the 20+ year old [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) that replaced them, instead. – Mike 'Pomax' Kamermans Feb 25 '23 at 16:08
  • treat the above question as rhetorical. that dup-target _does_ answer this question. you don't need an extension. you need to understand the type system and help guide it. – starball Feb 25 '23 at 23:08
  • Thanks for edit my question, I found the answer in your edit – Kuj9xst3 Feb 26 '23 at 03:15

1 Answers1

-1

I would suggest using addEventListener instead of onClick. It should look like this.

x.addEventListener("/* Event to listen for eg: click */", /* function to be run when the event happen */)

x.addEventListener("click", function listener(){
 console.log("listening")
})
franklin
  • 89
  • 4
  • this doesn't answer the question. it's just code review. see the answer I posted in the dup-target. – starball Feb 25 '23 at 23:06