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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:57:05+00:00 2026-06-16T22:57:05+00:00

<body> <div data-role=page> <div align=center id=mainPageContent1 data-role=content> <div data-role=controlgroup id=game_part1s data-type=horizontal> <a data-role=’button’ id=’btn1′

  • 0
    <body>
    <div data-role="page">

    <div align="center" id="mainPageContent1" data-role="content">    
            <div data-role="controlgroup" id="game_part1s" data-type="horizontal">

<a data-role='button' id='btn1' href='javascript:changeGamePart("Reset1");'>0 - 5 min</a>
<a data-role='button' id='btn2' href='javascript:changeGamePart("2");'>6 - 10 min</a>
<a data-role='button' id='btn3' href='javascript:changeGamePart("3");'>10 - 15 min</a>
<a data-role='button' id='btn4' href='javascript:changeGamePart("4");'>16 - 20 min</a>

             </div>
        </div> 
    </div><!-- /page -->

<script>
$(document).ready(function() {
    setInitialGamePart();
});
function setInitialGamePart() {
    changeGamePart(1);
}
function changeGamePart(nButtonId) {
    for (var iPart = 1; iPart < 5; iPart++) {
        if (nButtonId == iPart) {
    //alert('add class' + iPart);
            $('#btn' + iPart).addClass("ui-btn-active");
            } else {
    //alert('remove class' + iPart);
                $('#btn' + iPart).removeClass("ui-btn-active");
                }
            }
        }

    </script>
</body>

On Page Init, the setInitialGamePart is called and it sets the first button as active and rest as not active. When I click any other button, all buttons go not active(normal buttons not highlighted)

Not sure what is the error here

JSFiddle here http://jsfiddle.net/fFZ6S/

As you will see, the init works fine but clicking on the button does not. help please

  • 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-16T22:57:06+00:00Added an answer on June 16, 2026 at 10:57 pm

    I fixed this by changing the href to href=’#’ so old code was

    <a data-role='button' id='btn1' href='javascript:changeGamePart("1");'>0 - 5 min</a>
    

    my new code looks like

    <a data-role='button' id='btn1' href='#' onclick='javascript:changeGamePart("1");'>0 - 5 min</a>
    

    Got the hint from this stack..
    jquery mobile force ui-btn-active on navbar button

    Here is the JSFiddle for you guys
    http://jsfiddle.net/fzaqu/

    Hope it helps you

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

Sidebar

Related Questions

I have: <div data-role=page class=type-interior> <div data-role=content class=ui-body> <a href=#transitionExample data-role=button data-rel=popup> Pop Up
I have a Jquery Mobile controlgroup with two buttons: <div data-role=controlgroup data-type=horizontal class=headerMenu iconposSwitcher>
Trying to fire the .click() event for my controlgroup. Coded HTML: <div data-role=content class=ui-content
This is my first HTML page: <!--first.html--> <html> <body> <div data-role=page data-theme=a data-url=first id=first>
If I have a structure like this: <body> <div data-role=page data-dom-cache=true id=foo>...</div> <div data-role=page
I have various pages in html like this <body onload=init()> <div data-role=page id=home> <div
I have two div tags in single HTML with data-role as 'page'. First one
... in fact all markup that i put before the <div data-role=page>...</div> is visible
I have this code to work with: <div data-role=content> <div data-role=content> <form id=registerForm action=/register
Short: Do you put the data-role portions (header|content|footer) in your layout/master page or in

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.