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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:50:10+00:00 2026-06-06T15:50:10+00:00

Hi I’m fairly new to web development and am stuck at the very first

  • 0

Hi I’m fairly new to web development and am stuck at the very first project I have set myself.

I’m trying to create a team selection page where different team formations can be selected and the images will be dynamically ordered according to the selected formation.

I don’t know if this can be achieved using CSS only, or whether I have to combine it with javascript or jquery (I’m trying to learn all 3 so it’s a steep learning curve).

I think I can create a list in the html ul li, and then dynamically change the class of each li depending on the selected formation.

e.g. for soccer, formation 442 would have:

GK
DEF DEF DEF DEF
MID MID MID MID
STR STR

but if the formation was changed to 541 then the images would change to show

GK
DEF DEF DEF DEF DEF
MID MID MID MID
STR

Could anybody provide me with hints as to what possible solutions there are to this issue and I will read up further to try and understand.
e.g. do I need to create a javascript function for each formation type, give an id to each li element and set the CSS for each element depending on the selected formation
e.g do I use jquery to add CSS class to each li element depending on selected formation

  • 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-06T15:50:11+00:00Added an answer on June 6, 2026 at 3:50 pm

    Here’s a piece of code which may help you with what you need.

    <div>
        <ul id="ulGoalkeepers"><li>GK</li></ul>
        <hr />
        <ul id="ulDefenders"></ul>
        <hr />
        <ul id="ulMidfielders"></ul>
        <hr />
        <ul id="ulStrikers"></ul>
    </div>
    <select id="ddlFormation">
        <option></option>
        <option value="4-4-2">4-4-2</option>
        <option value="4-5-1">4-5-1</option>
    </select>
    <script type="text/javascript" language="javascript">
        function formationChanged(){
            var formation = $("#ddlFormation").val();
            if (formation != undefined && formation != '') {
                $("#ulDefenders").empty();
                $("#ulMidfielders").empty();
                $("#ulStrikers").empty();
    
                var parts = formation.split('-');
                var defenders = parts[0];
                var midfielders = parts[1];
                var strikers = parts[2];
    
                for (var i = 0; i < defenders; i++) {
                    $("#ulDefenders").append('<li>DEF</li>');
                }
                for (var i = 0; i < midfielders; i++) {
                    $("#ulMidfielders").append('<li>MID</li>');
                }
                for (var i = 0; i < strikers; i++) {
                    $("#ulStrikers").append('<li>STR</li>');
                }
            }
        }
    
        $(document).ready(function () {
            $("#ddlFormation").bind("change", formationChanged);
        });
    </script>
    

    EDIT:
    I don’t like the idea with CSS because you lose the structure of html elements. Defenders, midfielders are all will be in the same list and that is not very good.
    On the other hand there might be some ideas how to implement that and a lot depends on what you really need. For example:

    CSS:

        .team div
        {
            float: left;
            width: 50px;
        }
        .team div.first
        {
            clear: both;    
        }
    

    HTML:

        <div class="team">
            <div class="goalkeeper">GK</div>
            <div class="defender first">DEF</div>
            <div class="defender">DEF</div>
            <div class="defender">DEF</div>
            <div class="defender">DEF</div>
            <div class="midfielder first">MID</div>
            <div class="midfielder">MID</div>
            <div class="midfielder">MID</div>
            <div class="midfielder">MID</div>
            <div class="striker first">STR</div>
            <div class="striker">STR</div>
        </div>
    

    But that does not work in IE7. You may try to investigate this a bit more.
    Another idea is to use css absolute positioning. For example you add appropriate classes via jquery, so one item would have for example class=”midfielder second” and you interprete this in css like “top” css style from “midfielder” class and “left” css style from “second” class.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is

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.