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

The Archive Base Latest Questions

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

Thanks for taking the time, I am working on a page for an app

  • 0

Thanks for taking the time,

I am working on a page for an app where the admin reviews a submitted objective. Each objective is a inside 1 of 3 different tables. “review”, “complete”, and “submitted” are the three tables.

There is a bootstrap btn-group on each with an option to approve, revert or deny depending on which status it currently has. When the status is changed the containing the objective is removed and appended to the proper table.

You can see an example of the functionaliy here:
http://jsfiddle.net/9mYZD/

Now here is the issue:

  • When one of the ‘s is moved to another table I need to it to switch the links in the drop down so they will match the others in its new table.
  • I have code to do this, but I am trying to write a statement that would work

    tableID = clicked.closest('table').attr('id');
    if(tableID = 'approve-objectives-submitted'){
                    clicked.html('<i class=" icon-undo"></i> Revert').removeClass('action-ok').addClass('action-revert');
                    }
                    else if(tableID = 'approve-objectives-review'){
                    clicked.html('<i class=" icon-ban-circle"></i> Deny').removeClass('action-ok').addClass('action-deny');
                    }
    

If you look at the fiddle provided, I have added this code to the approve function. If you then approve one from submitted, the switch works great, if you approve one from review(they are appended at the very bottom of the list) then you can see the is two revert button rather than one deny and one revert.

If anyone has an idea on how to make this conditional statement work. or maybe i just need to take a step back and look at this from another perspective. Any thoughts would be great.

Thank you!

  • 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-13T22:56:04+00:00Added an answer on June 13, 2026 at 10:56 pm

    There were a couple of things I noticed.

    I have changed the code in your approve: function () and put up a new fiddle http://jsfiddle.net/5aVCp/

    Firstly, your newly appended table row was losing its objective id and the way you get the HTML from the table row was leaving a very small timing window with the posibility of the element being removed from the DOM before you get the HTML.

    Secondly, when you were replacing the contents of the last div, the btn-group class div was disappearing. Maybe I missed what this part was doing.

    Finally, the approach I took to modifying the labels as per the other rows values was to use the attribute you already include on the anchor tag to simply find them after you append them to the new table and manipulate the HTML as required:

       var dataId = clicked.attr('data-id');
       var ok = $('a[data-id="' + dataId + '"].action-ok');
       var deny = $('a[data-id="' + dataId + '"].action-deny');
       deny.removeClass('action-deny').addClass('action-revert').html('<i class=" icon-undo"></i> Revert');
       ok.removeClass('action-ok').addClass('action-deny').html('<i class=" icon-ban-circle"></i> Deny');
    

    You would be able to do this for each other type of status, just make sure you run the selectors before updating any of their classes or you might find you change one and re select it again.

    Hopefully this helps.

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

Sidebar

Related Questions

first of all thanks for taking your time! I'm a junior Dev, working with
First of all, thanks for taking the time to read this. I've been working
Final EDIT working code (Huge thanks to Claus for taking time and solving it):
thanks for taking the time to look at my question. I've been diving into
Thanks for taking the time to read this. I have an unknown number of
thanks for taking the time to stop by my question. Below you will find
Thanks for taking some time to help me out. Using: Microsoft Visual C# 2010
First of all thanks for taking the time to look into this. I store
Thanks everyone for taking the time to read this. I have styled my navigation
Thanks in advance for taking the time to read my question. I'm using MySQL

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.