I use
href="javascript:void(0)"
to disable the href property and then use onlclick to give functionality to my anchor elements. How can I do this programatically.
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.
A few issues if I may.
I would suggest an unobtrusive approach
I would not use return false. It could have unexpected results. A quick google search will have more info.
Use preventDefault() to remove the default functionality.
https://developer.mozilla.org/en/DOM/event.preventDefault
Edit:
If you’re unsure how to control the click event unobtrusively, addEventListener() is what you are after. You can control everything from there, including preventDefault()
https://developer.mozilla.org/en/DOM/element.addEventListener