Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
Adding a game score to a tweet template

I've created a quiz type of website and I was wondering how I can change my code to add the score to the tweet

<button class="tweet-score" onclick="window.location.href="window.location.href="//twitter.com/intent/tweet?text=Check%20out%20my%20score%20on%20this!%3A&url=http%3A%2F%2Fexample-quiz.com/%2F">Share your score</button>

To display the score on the results html page, I just use #score with the CSS being as simple as:

#score{
    font-size: 100px;
    margin: 50px 0px;
}

Here is the JavaScript:

function showScore(){
    var queryString = window.location.search
    var score = new URLSearchParams(queryString).get("score")

    $('#score').html(score + '/10')
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think the quotes might be the issue. Instead try to bind a function.

 onclick="tweet()"

function tweet() {
   window.location.href = "theUrl"
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda