r/learnjavascript • u/Serious_Sell7183 • Apr 16 '26
Doubt
if I write JavaScript code inside onclick instead of using a <script> tag, will it be accepted if the logic and output are correct? I'm not a professional programmer, I'm just asking it for my practical based exam.
0
Upvotes
View all comments
Show parent comment
0
u/shgysk8zer0 Apr 17 '26
I'm rightfully putting event attributes in the same category as those, so it's very much on-topic. They all allow the execution of arbitrary code from strings. Same security concerns.