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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:21:08+00:00 2026-06-13T03:21:08+00:00

I have a table with 1 button in each row, on click of button

  • 0

I have a table with 1 button in each row, on click of button tax shown in that row will be applied to the client and i need to show some indication to end user. I want to change the button css(color, txt ect.) on click for that purpose. Below is the code –

<table class="data report_table">       
                        <tbody>
                        <c:forEach var="taxVO" items="${taxVo}" varStatus="item">
                        <tr class="${item.index % 2 == 0 ? 'odd gradeX' : 'even gradeC'}">                          
                            <td><c:out value="${taxVO.taxName}" /></td>
                            <td><input type="button" class="btn-icon" value="Apply" id="applyTaxButton" onClick="applyTax('${taxVO.taxId}');"></input>
                            </td>   
                        </tr>
                        </c:forEach>
                        </tbody>
                    </table>

and jquery i am using is –

function applyTax(taxIdValue)   {
    $('#taxId').val(taxIdValue);
    $(this).$('#applyTaxButton').css("background-color","yellow");
}

but i am getting error – Uncaught TypeError: Object [object Object] has no method ‘$’. Can someone please let me know how to fix it?

  • 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-13T03:21:10+00:00Added an answer on June 13, 2026 at 3:21 am

    jsFiddle Demo

    HTML IDs should be unique, so you should not have the all buttons having the same ID. Use the class attribute for that purpose. However, to simply change the context of your selection, the correct syntax is:

    $(selector, context);
    

    A better approach is to remove the onclick attribute altogether, and handle the event completely in jQuery:

    $(function() {
        $('.report_table').on('click', '.btn-icon', function() {
            $(this).css('background-color', 'yellow');
            $('.btn-icon').not(this).css('background-color', 'transparent');
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datable and Edit button in each row. When I click that
I have a table where each row has a button for deletion. Actually I
I have a table that has some 50 rows. The last cell of each
I have a table that has Edit and Delete links in each row. I
I have some Javascript that dynamically adds rows/fields when you click the button, Add
I have a ListView that creates a table. Each row in the table has
In this jsfiddle http://jsfiddle.net/littlesandra88/eGRRb/ have I submit buttons that are auto-generated. Each table row
I have a table with items in a row, each item have a button.
I have a table with multiple rows, with each row having a button within
I have a table with a hidden field in each row. I need to

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.