I wish to put some instructions with a link - onclick calling a script that display a simple alert box. If I did like this...
<label for="arquivo">Máximo de 1MB, observe os <a href="" onclick="ajudaUpload();">tipos permitidos</a>.</label>
the page is reloaded even with a return false, and if I did like this...
<label for="arquivo">Máximo de 1MB, observe os <a href="#" onclick="ajudaUpload();">tipos permitidos</a>.</label>
with the "#" symbol, the page is scrolled to the top and "#" is added to query string. Is there a third way to do it without reloading, scrolling and garbage?
You can use
.preventDefault()
method, or return false, or remove the HREF tag all together. Either should work just fine.Vc nao deviar estar usando
onclick
dessa forma pra comecar. Ja eh bem antigo e nao se usa assim mais.