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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:36:56+00:00 2026-06-13T10:36:56+00:00

I am using angularjs v0.9 to implement my membership beta system… Currently, I have

  • 0

I am using angularjs v0.9 to implement my membership beta system…

Currently, I have two controllers…

var selected = []
function Ctrl1(){
    checkCheckboxesByIds(selected );
    //users will select a list of values from checkboxes..
    $('#renewlist input:checked').each(function() {
    selected.push($(this).attr('value'));
    });    
}

function Ctrl2(){
//call an api function with "selected"
}

however, in the html of Ctrl2, it gives the user a choice to move back to the previous if he or she has selected a checkbox wrongly..

I have googled and found this function

function checkCheckboxesByIds(ids) {
 $.each(ids, function(i, id) {
    $('#member-' + id).attr('checked', 'checked'); 
 });
}

However, this only works 75% of the time. If I repeatedly click back and forward, the checkboxes will sometimes fail to be checked…

Is there anyway I can make it more foolproof??

Thank you in advance.

  • 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-13T10:36:57+00:00Added an answer on June 13, 2026 at 10:36 am

    As mentioned by @wirey

    I really should be using .prop(‘checked’, true) to set the checked property.

    function checkCheckboxesByIds(ids) {
     $.each(ids, function(i, id) {
        $('#member-' + id).prop('checked',true); 
     });
    }
    

    It is still not foolproof because the sixth time I submit and return, the checkboxes will not be checked. But this is good enough for my purpose.

    Thank you.

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

Sidebar

Related Questions

Using the AngularJS framework, how do I have the Submit button both update the
I am using Angularjs for a web application. I have tried searching to find
I have an application built using AngularJS and a server-side backend that delivers all
Using online interfaces to a version control system is a nice way to have
I am using AngularJS 1.0, PHP, and mysql with localhost on my Mac. I
How do I stop Smarty throwing an error when I'm using AngularJS in the
I'm using the standard asp:Login control, and we have a user who recently changed
I have several TextBoxes, which display angular values. I format these using different custom
I have gyroscope + accelerometer data at each time period T . Using C++,
Using AngularJS if I set a simple input text box value to something like

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.