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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:44:17+00:00 2026-05-14T08:44:17+00:00

I have a specific question, I have a link in a table in the

  • 0

I have a specific question, I have a link in a table in the third column of each row, when the user clicks that link he loads some ajax and updates the page, what I want to also happen is that in the 2nd column of the row where the link is, change the td’s class from false to true, and the value from No to Yes.

Thanks!

Update!
Code Example:

The 2nd column still doesn’t get updated on click, perhaps this is because the div where the table is located gets hidden onclick? Anyways here’s what I’ve tried:

<tr>
  <td>00839</td>
  <td class="false"  style="text-align:left;">No</td>
  <td>      
    <a href="#" 
       onclick="Element.hide('ajax-instruction-view');; 
       new Ajax.Updater('ajax-instruction-view', '/tasks/show_ajax/839', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Appear(&quot;ajax-instruction-view&quot;,{});window.scrollTo(0,0);
       link = $(link);
       var row = link.up('tr');
       var cell = row.down('td').next('td');
       cell.update('Yes');},
       parameters: 'authenticity_token='encodeURIComponent('SYWsdBTWlz17u9HmPXA2R9WmBfZn67g/IAMGyhHEwXw=')}); return false;"
    >
      Instructions-Notice Board
    </a>
  </td>
  <td>19/04/10</td>
  <td class="false">21/04/10</td>
  <td class="false"  style="text-align:left;">None.</td>
</tr>
  • 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-05-14T08:44:17+00:00Added an answer on May 14, 2026 at 8:44 am

    It sounds as though at some point, you have a reference to the link the user clicked (either because you have a click handler on it or because you’re using event delegation and finding it after a click on the table). Starting with a reference to that link, you can use Prototype’s DOM traversal stuff to find the second table cell:

    Edit Based on your response to rahul, I would change your link onclick to:

    onclick="handleLinkClick(this); return false;"
    

    …and this would be handleLinkClick:

    function handleLinkClick(link) {
    
        // Original code (mostly unchanged)
        Element.hide('currentdiv');
        new Ajax.Updater('someajax', 'ajax.html', {
            asynchronous:true,
            evalScripts:true,
            onComplete: function(request) {
                new Effect.Appear("newdiv",{});
                window.scrollTo(0,0);
    
                // New code starts here
    
                // Extend the link element
                link = $(link);
    
                // Find the row
                var row = link.up('tr');
    
                // Find the second column
                var cell = row.down('td').next('td');
    
                // Change the cell's "class" and "value" -- I've had to guess a bit at
                // what you want to do here
                if (cell.hasClassName("true")) {
                    cell.removeClassName("true").addClassName("false");
                    cell.update("No");
                }
                else {
                    cell.removeClassName("false").addClassName("true");
                    cell.update("Yes");
                }
    
                // End of new code
            },
            parameters:'authenticity_token=' + encodeURIComponent('SYWsdBTWlz17u9HmPXA2R9WmBfZn67g/IAMGyhHEwXw=')
        });
    
    }
    

    That uses Element#up, Element#next, Element#hasClassName, Element#addClassName, Element#removeClassName, and Element#update; docs for them here.

    Optional things to consider:

    • The above is fragile in that if you change the location of that cell (make it the third column rather than the second), it fails. You might use a marker class to find it.
    • Rather than an onclick attribute, you could use Element#observe.
    • You can use event delegation to have just one handler on the table, rather than a handler on each link.

    But the above should work.

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

Sidebar

Related Questions

I have a specific question, that could use a general answer... When building Multi-Tier
Sorry for a pretty specific question. I have a table (see bottom), and when
Skip to the specific question as needed. Some background: The scenario: I have a
I have a MySQL table , each row representing a Person. For each person
I have a specific question about looping variable names in WPF. XAML code looks
i have this specific question to do to you, i have a database from
I have a fairly specific question about concurrent programming in C. I have done
This is quite a specific question, and I have had no luck on the
I have a specific case in mind, but the question applies in general too.
This question is kind of related to another question but I have a specific

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.