Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:31:27+00:00 2026-06-09T04:31:27+00:00

I have the following javascript code: game.bind(‘gameover’, function(seconds) { setTimeout(function() { var rank =

  • 0

I have the following javascript code:

game.bind('gameover', function(seconds) {
    setTimeout(function() {
      var rank = game.getRank(seconds);
      scorecard.find('.time').text(seconds + ' sec');
      scorecard.find('.rank').text(rank[0]);
      scorecard.find('.byline').text(rank[1]);
      ...more code

In the following div this data is displayed (so the js script is working):

<div class="inner">
  <h3>Nice job! Your time:</h3>
  <h1 class="wobble time"><!-- 15 seconds --></h1>
  <h2 class="rank"><!-- Friendly Mallard --></h2>
  <h3 class="byline"><!-- (That's pretty good) --></h3>
</div>

Now I want to put the results also in a form so I can post it to the a database (mysql). So I’ve added a form and put it in the same div:

<form id="form" action="updatescore.php" method="post">
  <input type="text" id="time" name="time" value="" />
  <input type="text" id="rank" name="rank" value="" />
  <input type="text" id="byline" name="byline" value="" />
</form>

Now in the JS I’ve copied the lines (e.g. scorecard.find('.time').text(seconds + ' sec');) and changed it to look for the id, so . becomes # and passed it in the js like:

scorecard.find('.time').text(seconds + ' sec');
scorecard.find('#time').text(seconds + ' sec');
etc

So this should work I think, but the form inputs stay empty. What am I doing wrong?

Kind regards,

Maurice

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:31:29+00:00Added an answer on June 9, 2026 at 4:31 am

    Use val() instead of text() for setting the values

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following JavaScript code: var cILo=true; var img1=images/title-2a.png; var img2=images/title-2b.png; function loadblinker()
I have the following JavaScript code: var xmlHttpReq = getXmlHttpObject(); xmlHttpReq.onreadystatechange=function(){ if (xmlHttpReq.readyState ==
I have the following javascript code. var Test = function(){ $(#+elementId).click(function(){ // How to
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; var valid
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
Say I have the following JavaScript code (in global context): var t = setTimeout(f,
I have the following javascript code: <script type=text/javascript> $(function () { var currentDateTime =
I have the following javascript code: function initSite(){ var site; $.getJSON(www+'init/initSite', function(data) { site
I have the following Javascript code that works perfectly: $(document).ready(function() { $(#Select1).setDefault(); $(#Select2).setDefault(); $(#Select3).setDefault();
I have the following JavaScript code: var x = ['CFMG','JMFMG','CPMAF']; var y = $.param({'test':x});

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.