question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

element.setAttribute('onclick', ...) ???

See original GitHub issue

Hello, In the 0.5.x of tags version, for event handling(eg. onclick),Through`else if (name[0] === “o” && name[1] === “n”) { var event = name.substr(2) element.removeEventListener(event, oldValue) element.addEventListener(event, value)

	}` to deal with, now through `element.setAttribute` to deal with,In the brower, compiled code such as :

image

This logic is exposed to the HTML on whether there is any safety problems?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
leeoniyacommented, Apr 2, 2017

just set all on* attrs as properties: el.onclick = ....

0reactions
jorgebucarancommented, Apr 2, 2017

just set all on* attrs as properties: el.onclick = …

Yes, this is probably it, thanks @leeoniya 👌👍.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does an onclick property set with setAttribute fail to work ...
Turns out to get IE to run an onclick on a dynamically generated element, we can't use setAttribute. Instead, we need to set...
Read more >
setAttribute('onclick', 'alert(this.id)') works for existing element ...
I can - using setAttribute - add an event handler, for instance onclick, to elements existing in the HTML source but if I...
Read more >
Setting and changing the onclick attribute with Javascript
If you need to change or assign a value to the onclick attribute of a DOM element, you have two options; you can...
Read more >
Introduction to Browser Events | W3docs JavaScript Tutorial
If you assign two event handlers for that, the DOM property will overwrite the existing one, like this: w3docs logo Javascript setAttribute onclick...
Read more >
HTML onclick Event Attribute - W3Schools
Definition and Usage. The onclick attribute fires on a mouse click on the element. Browser Support. Event Attribute.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found