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

  • SEARCH
  • Home
  • 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 7544853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:46:51+00:00 2026-05-30T08:46:51+00:00

var macTeamList = Team + <br>; var macScoreList = Score + <br>; var nicTeamList

  • 0
 var macTeamList = "Team" + "<br>";
  var macScoreList = "Score" + "<br>";
  var nicTeamList = "Team" + "<br>";
  var nicScoreList = "Score" + "<br>";

 $('form').submit(function(e) {

     if ($('input[name="Player1"]').val() ==="Nic") {

      e.preventDefault();
      var nicTeamValue = $('input[name="Team1"]').val();
      nicTeamList += nicTeamValue + "<br>" ;

      var nicScoreValue = $('input[name="Score1"]').val();
      nicScoreList += nicScoreValue + "<br>";

      $('#nicteamcolumn').html(nicTeamList);
      $('#nicscorecolumn').html(nicScoreList);

      return false;
     }

 else if ($('input[name="Player1"]').val() === "Mac") {


      e.preventDefault();
      var macTeamValue = $('input[name="Team1"]').val();
      macTeamList += macTeamValue + "<br>" ;

      var macScoreValue = $('input[name="Score1"]').val();
      macScoreList += macScoreValue + "<br>";

      $('#macteamcolumn').html(macTeamList);
      $('#macscorecolumn').html(macScoreList);

      return false;
 } 
 })

    <form>

<input name="foo" id="team" class="teamcolumn" type="text" value="Team?">
<input name="foobar" id="score" class="inputright" type="text" value="Score?">

<input type="submit" value="Go">

<select name="select" size="1" id="PID">
    <option value="Nic">Nic</option>
    <option value="Mac">Mac</option>
    </select>
</form>
<div  id ="nicteamcolumn" class="teamcolumn TOSRcolumn nicColumn">Team </div>
 <div id="nicscorecolumn" class="scorecolumn TOSRcolumn nicColumn">Score</div>
 <div id="macteamcolumn" class="teamcolumn TOSRcolumn macColumn">Team </div>
 <div id="macscorecolumn" class="scorecolumn TOSRcolumn macColumn">Score</div>

Basically, I am having the user input 2 text values as well as choose from 2 options on a drop down menu. If the user chooses “Mac” the info in the two fields should print to #macscorecolumn and #macteamcolumnand vice versa if they choose “Nic”. The list variables are keeping track of the whole list of scores so the new score is simply added to the end and they’re all shown. Not sure why the script isnt working. Any help would be awesome

  • 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-05-30T08:46:53+00:00Added an answer on May 30, 2026 at 8:46 am

    First of all, your code actually needs a rewrite 🙂

    1. You don’t need to submit a form to do this kind of thing, you could merely add either a link or a button (for GO), add a click function to it, and do your stuff in there.
    2. Also I agree with Kunal that your syntax for the if statement is incorrect etc.

    Just practice some more and remember that the jquery docs is your friend… 🙂

    Here is your code I modified a little bit to make it work for you. But remember, you don’t need a form for this, I just didn’t have time to rewrite it differently for you. I also included jquery library just in case you missed that, which is critical.

        <form>
    
    <input name="foo" id="team" class="teamcolumn" type="text" value="Team?">
    <input name="foobar" id="score" class="inputright" type="text" value="Score?">
    
    <button id="dostuff" value="Go">Go</button>
    
    <select name="select" size="1" id="PID">
        <option value="Nic">Nic</option>
        <option value="Mac">Mac</option>
        </select>
    </form>
    <div  id ="nicteamcolumn" class="teamcolumn TOSRcolumn nicColumn">Team </div>
     <div id="nicscorecolumn" class="scorecolumn TOSRcolumn nicColumn">Score</div>
     <div id="macteamcolumn" class="teamcolumn TOSRcolumn macColumn">Team </div>
     <div id="macscorecolumn" class="scorecolumn TOSRcolumn macColumn">Score</div>
        <script src="js/jquery-1.6.4.min.js"></script> 
    
    <script>    
            var macTeamList = "Team" + "<br>";
          var macScoreList = "Score" + "<br>";
          var nicTeamList = "Team" + "<br>";
          var nicScoreList = "Score" + "<br>";
    
         $('#dostuff').click(function(e) {
                    e.preventDefault();
                    var teamvalue = $('input[name="foo"]').val();
                    var teamscore = $('input[name="foobar"]').val();
                    var pidType = $("#PID").val();
    
    
             if (pidType =="Mac") {
    
              nicTeamList += teamvalue + "<br>" ;
              nicScoreList += teamscore + "<br>";
    
              $('#nicteamcolumn').html(nicTeamList);
              $('#nicscorecolumn').html(nicScoreList);
    
             }
    
                else {
    
    
              macTeamList += teamvalue + "<br>" ;
              macScoreList += teamscore + "<br>";
    
              $('#macteamcolumn').html(macTeamList);
              $('#macscorecolumn').html(macScoreList);
    
    
         }
         });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

var query1 = urlencode($('input[name=searchTerm1]').val()); //user1 var query2 = urlencode($('input[name=searchTerm2]').val()); //user1 var rpp = 20;
var query1 = urlencode($('input[name=searchTerm]').val()); //user1 $.getJSON('http://twitter.com/friends/ids.json?screen_name='+ query1 +'&jsoncallback=?', function(data){ $('content').append(''+data.length+''); }); This is a
var $imagefile = $('<input />') .attr({ type: 'file', name: 'imageFile', id: 'imageFile' }); Above
var name = #floatMenu; var menuYloc = null; $(document).ready(function () { menuYloc = parseInt($(name).css(top).substring(0,
var y = new w(); var x = y.z; y.z= function() { doOneThing(); x();
var thumbs = document.getElementsByTagName(img); for (var i=0; i<thumbs.length; i++) { Core.addEventListener(thumbs[i], click, function() {alert(i);});
var results = ['one', 'two', 'one hundred', 'three']; var removal = []; $.each(results, function(i)
var UsersMenu = function(){ this.returnUsers = []; this.retrieve = function(posts){ var temp = [];
var allRapidSpells = $$('input[value^=RSW]'); Can anyone tell me what that does?
var plugin = { Init: function() { this.UpdateUI(); if (this.Status() == 1) { ...

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.