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 9216527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:26:12+00:00 2026-06-18T02:26:12+00:00

I am trying to make a simple game using HTML 5, CSS, and JQuery.

  • 0

I am trying to make a simple game using HTML 5, CSS, and JQuery. However, the imported .js file that I used as a test, “game.js” does not have any effect on the layout of the game (the css code makes the pong paddles blue, but the jquery code is supposed to overwrite and make the paddles red). In my HTML file I referenced ‘http://code.jquery.com/jquery-1.9.0.min.js’ as my jquery source. Any help would be appreciated.

HTML (index.html):

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
<body>
  <header>
    <h1>Pong</h1>
  </header>
  <div id = "game">
  <div id = "playArea">
    <div id= "paddleA" class="paddle"></div>
    <div id= "paddleB" class="paddle"></div>
    <div id= "ball"></div>
  </div>
  </div>
  <footer>
    Its like Pong. Exactly like Pong.
  </footer>
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
  <script type="text/javascript" src="game.js"></style>
</body>
</html>

CSS (styles.css):

#playArea{
background: #FFFF99; 
width: 650px;
height: 400px;
position: relative;
overflow: hidden;
}

#ball {
background: #990000;
position: absolute;
width: 20px;
height: 20px;
left: 320px;
top: 100px;
border-radius: 10px;                
}

.paddle {
background: #66FF99;
left: 50px;
top: 70px;
position: absolute;
width: 30px;
height: 70px;
}

#paddleB {
left: 570px;
}

jQuery (game.js):

$(function(){
    $("#paddleB").css("top", "100px");
    $("#paddleA").css("top", "60px");
    $(".paddle").css("background", "red");
});
  • 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-18T02:26:13+00:00Added an answer on June 18, 2026 at 2:26 am

    $(document).ready(function(){} and $(function(){} are the same thing, so this might be causing issues. I suggest you try only using one of them.

    e.g.

    $(function(){
        $("#paddleB").css("top", "100px");
        $("#paddleA").css("top", "60px");
        $(".paddle").css("background", "red");
    });
    

    EDIT

    Scratch that! You have </style> at the end of the game.js inclusion rather than </script>

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

Sidebar

Related Questions

I'm trying to make simple script using jquery $post function to pass data to
I'm trying to make a simple 2D game using SFML and this tutorial. Here's
I am trying to make a simple pong game using opengl-es. I have checked
I am trying to make a simple item database using MySQL for a game.
I'm trying to make a simple windows 8 metro game using c# and xaml.
I'm trying to make a simple 2d game in OpenGL ES 2 using marmalde
I am trying to make a simple skateboarding game using AndEngine and the Box2D
I'm trying to make a simple multiplayer game using canvas, socket.io and node.js. Everything's
Trying to make simple minesweeper game in python, but have one problem. I have
I am playing around with trying to make a simple Roguelike game to learn

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.