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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:31:09+00:00 2026-06-14T00:31:09+00:00

I use JQuery and I have a web page which lists multiple rows with

  • 0

I use JQuery and I have a web page which lists multiple rows with radio buttons and text boxes in each row. I am trying to enable the textbox when I click on the radio button in a row. What I am expecting is – it should enable/disable the text box only in that row. It shouldnt enable/disable the text boxes in other rows.

By default all text boxes in each row is disabled on page load. I researched and I was able get a solution to enable a textbox which when I click on a radio button. Now when I select another radio button i expect the previously enabled text box should get disabled again and the text box in the current row should now get enabled. This is what I am trying to achieve.

I did lot of research and most answers doesnt suit the requirements. Please kindly help. I use JQuery, I tried to get solution with Jquery and javascripts as well.

Here is the code:

<div class="content">   
    <form name="selectedMatIds" action="@{addMaterialsToBuffer()}" method="POST">
    <div class="separator" style="margin-top:30px"><h4>Materials found</h4></div>
    <table class="table MaterialTable" id="makeZebras">
        <thead>
        <tr>
                <th class="alignLeft first">
                    Code
                </th>
                <th class="alignLeft">
                    Measure
                </th>
                <th class="alignLeft">
                    Unit
                </th>
                <th class="alignLeft">
                    New Unit
                </th>
            </tr>
        </thead>
        <tbody>
            #{list items:foundList, as:'mat' }
            <tr>
                <td>
                    <input type="radio" name="selectedMatIds" id="selectedMatIds" value="${mat.id}" onclick="getMaterialID()"> ${mat.materialCode} 
                </td>
                <td>
                    ${mat.bum}
                </td>
                <td>
                    ${mat.iumPerBum}
                </td>
                <td>
                <div id="group">
                    <input type="text" id="newIUM" name="${mat.id}" value="${newIUM}" disabled>
                    <input type="hidden" id="oldIUM" name="oldIUM" value="${mat.iumPerBum}">
                    <input type="hidden" id="bum" name="bum" value="${mat.bum}">
                    <a id="save" onclick="loadURL1()">Save</a> <a>Cancel</a>                        
                </div>
                </td>
            </tr>
            #{/list}
        </tbody>
        <div class="actions">
            <input type="submit" class="primary" value="Continue">
        </div>
    </table>

Now, the Jquery script:

$("input:radio[name='selectedMatIds']").click(function() {
    var isDisabled = $(this).is(":checked");
    var value = $(this).val();
    var textValue = $("#newIUM").val();
    alert(isDisabled);
    alert(value);
    alert(textValue);
    if(isDisabled) $("#newIUM").removeAttr("disabled");
    else $("#newIUM").attr("disabled", isDisabled);
});
  • 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-14T00:31:10+00:00Added an answer on June 14, 2026 at 12:31 am

    Use .closest()

    $("input:radio[name='selectedMatIds']").click(function() {
          var value = $(this).val();
          var $closest = $(this).closest('tr'); // Find closest tr 
          // Find the value of the textbox in current row
          var textValue = $closest.find('input[type="text"]').val(); 
            //  Disable All Text Boxes
          $('.MaterialTable input[type="text"]').prop('disabled' , true);  
    
    
          // Only enable the textbox of the particular row
          $closest.find('input[type="text"]').prop('disabled' , false);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page with several jQuery ajax calls which fire asynchronously at
I have a web page which reloads some data using a jquery post every
I have started a new web application and have decided to use jquery as
I have an asp.net user control on which I want to use jquery ajax.
I have a web page containing a filtering text box and a list box.
We have a web page which is often reloaded by clicking F5 or Ctrl-R
1 Which one method is faster to open and use HTML5/jQuery Mobile page in
I have a web page which has three <div> elements: Right_bar contains several layouts
I have an ASP.NET MVC 3 (Razor) Web Application, with a particular page which
I have an android app which is native, I'm displaying a web page using

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.