1

i guess the headline is matching pretty good my question.
Usually when binding javascript-events i avoid binding those inline (with e.g. onclick). Anyway when I would do it I would just write onclick="someFunction();"

I just now read this answer https://stackoverflow.com/a/6307626/1402667 where onclick="javascript: someFunction();" is used. I only knew this to be a way to set the href of a link to an javascript function and I'm wondering if theres any use/difference in prepending "javascript:" inside of onclicks, onchanges, etc.

Can someone give me clearness whether it makes any difference?
Thanks in advance

Community
  • 1
  • 1
L. Monty
  • 872
  • 9
  • 17
  • 6
    Both should be omitted, use an event listener instead of worrying about it. – baao Oct 06 '15 at 20:16
  • yeah as i stated i avoid using it. But still its not clear to me ...and even if its bad practice i'd like to understand the intention of prepending this stuff – L. Monty Oct 06 '15 at 20:17
  • is throwback to era long over and gone – charlietfl Oct 06 '15 at 20:19
  • ok thanks...thats answering my question.... i will close it....just never saw it before – L. Monty Oct 06 '15 at 20:19
  • I'm voting to close this question as off-topic because it doesn't contain any error to solve and the question was only about an old way of writing javascript which lead to confusion – L. Monty Oct 06 '15 at 20:21

0 Answers0