Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!