Is there any difference between
1 : <a href="javascript:MyFunction()">Link1</a>
and
2 : <a href="#" onclick="MyFunction()">Link2</a>
?
Would one affect the page performance by any means ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your element is not actually supposed to link the user someplace, don’t make it an anchor element. If you’re using
<a>tags just to get the underline/cursor change – don’t. Use CSS on a<span>(or other element) instead.Keep your HTML semantic and use anchor elements only when you want to link the user somewhere.