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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:15:13+00:00 2026-06-09T23:15:13+00:00

I am using this iphone style checkbox. All checkboxes are checked by default. If

  • 0

I am using this iphone style checkbox. All checkboxes are checked by default. If it is unchecked, a modal is shown, which has a form and all. When I close this modal, I want the checkbox to be enabled again.

This is the JS that shows the modal when the checkbox is changed to false:

$(window).load(function() {
  var onchange_checkbox = $('.on_off :checkbox').iphoneStyle({
    checkedLabel: 'Confirm',
    uncheckedLabel: 'Edit',
    onChange: function(elem, value) {
        if($(elem)[0].checked==false){
            $('.modal').show();
            $("body").append('<div class="modalOverlay">');
        }
    }
  });
});

This is the table of checkboxes:

%{for(int i=0;i<confirmAtt.size ();i=i+9){}%
<tr>
<td>${confirmAtt.get(i)}</td>
<td>${confirmAtt.get(i+1)}</td>
<td>${confirmAtt.get(i+2)}</td>
<td>${confirmAtt.get(i+3)}</td>
<td>${confirmAtt.get(i+4)}</td>
<td>${confirmAtt.get(i+5)}</td>
<td>${confirmAtt.get(i+6)}</td>
<td>${confirmAtt.get(i+7)}</td>
<td>${confirmAtt.get(i+8)}</td>
<td class="modalInput on_off"><input type="checkbox" id="on_off_${i}"
    checked="checked" /></td>
</tr>
%{}}% 

The modal with the close button:

    <div class="modal" id="aModal">
        <p>
            <button class="close" onclick="foo();">Close</button>
        </p>
    </div>

which calls this function:

function foo(){
    $('.modal').hide();
    $('.modalOverlay').remove();
    onchange_checkbox.prop('checked', !onchange_checkbox.is(':checked')).iphoneStyle("refresh");
    //tried changing this line to
    //$('.on_off').attr("checked" , true);
    //doesn't work
}
  • 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-09T23:15:15+00:00Added an answer on June 9, 2026 at 11:15 pm

    If you just want to set the checkbox back to checked, you can use the following code:

    $(window).load(function() {
    
          var onchange_checkbox = ($('.on_off :checkbox')).iphoneStyle();
    
    
          onchange_checkbox.prop('checked', !onchange_checkbox.is(':checked'))
          .iphoneStyle("refresh");
    
    
    });
    

    http://jsbin.com/urocug/1/

    Update

    Sorry, I now see you tried to implement this within your code. The problem is that you are declaring the checkbox as a variable within $(window).load(function() { while you try to access the same variable outside the scope of $(window).load(function() {


    Ideally what you need to do is move your foo(){} function into your $(window).load(function() {:

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

Sidebar

Related Questions

I am using this code phone calling from iPhone its calling directly to particular
I'm using this code to resize an image on the iPhone: CGRect screenRect =
I am trying to follow this tutorial ( Using-core-plot-in-an-iphone-application ). When I try to
Hi have followed this tutorial using Core plot framework http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application My project compiles, but
On the iPhone: Using the US locale, a currency looks like this: $1,234.56 Using
This project is in Obj-C for iphone. I'm using the double float version of
Am looking into developing an iPhone native app using Titanium Developer Since this is
This is a slightly tricky question. I am using NSDateFormatter on the iPhone but
I'm using AVAudioPlayer to play sound effects in an iPhone game. This is part
I am working on a Labyrinth style app for iPhone using Chipmunk and openAL.

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.