Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
In liferay javascript is not working(user actions are not triggering)

HTML:-

<button type="button" onclick="alert()">Want a greeting?</button>

Javascript:-

function alert(){ alert('working...') }

refference image

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Call your function anything other than alert. It's a reserved keyword, and the error your code gives you is:

InternalError: too much recursion

function handleClick() {
  alert('working...');
}
<button type="button" onclick="handleClick()">Want a greeting?</button>

about 4 years ago · Juan Pablo Isaza Relatório

0

alert() is a built-in method of JavaScript.

https://developer.mozilla.org/en-US/docs/Web/API/Window/alert

If you change the name of your function that will fix the issue:

function test(){ alert('working...') }
<button type="button" onclick="test()">Want a greeting?</button>

You can override the alert method but you can't recursively call the same function. The issue you're running into is an infinite recursion, you're calling alert > alert > alert > alert > ...

Something like this would work, though.

window.alert = function alert(message){ console.log(message) }
<button type="button" onclick="alert('test')">Want a greeting?</button>

about 4 years ago · Juan Pablo Isaza Relatório

0

<button type="button" onclick="click()">Want a greeting?</button>

<script> let click = () => {alert('working...');}</script>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda