Este site irá ter funcionalidade limitada enquanto fazemos manutenção para melhorar a sua experiência. Se um artigo não resolve o seu problema e quiser colocar uma questão, temos a nossa comunidade de apoio à espera de o ajudar em @FirefoxSupport no Twitter, /r/firefox no Reddit.

Pesquisar no apoio

Evite burlas no apoio. Nunca iremos solicitar que telefone ou envie uma mensagem de texto para um número de telefone ou que partilhe informações pessoais. Por favor, reporte atividades suspeitas utilizando a opção "Reportar abuso".

Saber mais

HTML Link (<a href)- wrong behaviour

  • 2 respostas
  • 3 têm este problema
  • 10 visualizações
  • Última resposta por goncalofbg

more options

Hello,

This simple code

<a href="javascript:$('.div-feedback').fadeIn();">

doesn't work in my newest version of firefox 29.0.1. it works on chrome just fine as it should.

rather than interpret as javascript, it reads as an url (opens the page "javascript:$('.div-feedback').fadeIn();" which is wrong of course)

Do you have an idea why?

Thank you Gonçalo

Hello, This simple code <a href="javascript:$('.div-feedback').fadeIn();"> doesn't work in my newest version of firefox 29.0.1. it works on chrome just fine as it should. rather than interpret as javascript, it reads as an url (opens the page "javascript:$('.div-feedback').fadeIn();" which is wrong of course) Do you have an idea why? Thank you Gonçalo

Solução escolhida

Actually, the href attribute is supposed to direct the browser to a new URL, etc., not run a script. Instead, use the onclick event attribute:

   <a onclick = “$('.div-feedback').fadeIn();”></a>.

Happy coding!

Ler esta resposta no contexto 👍 0

Todas as respostas (2)

more options

Solução escolhida

Actually, the href attribute is supposed to direct the browser to a new URL, etc., not run a script. Instead, use the onclick event attribute:

   <a onclick = “$('.div-feedback').fadeIn();”></a>.

Happy coding!

Modificado por Epicaleb a

more options

Fair enough.

Thanks