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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:17:27+00:00 2026-06-16T02:17:27+00:00

I dynamically generated a php page with a single text element form and a

  • 0

I dynamically generated a php page with a single text element form and a table of data. Each row of the table has a barcode as the name (). As I scan each barcode in the form, I’d like to change the row color using jquery.

Php page simplified:

<form id="checkinProcess" class="mainForm" method="post" action="">
  <label>Barcode:</label>
  <input type="text" class="required" name="barocde" id="processBarcode"/>
  <input type="submit" value="submit" class="blueBtn" />
</form>

<table class="display" id="barcodeTable">
            <thead>
                <tr>
                    <th>Barcode</th>
                    <th>Amount</th>
                    <th>Code</th>
                </tr>
            </thead>
            <tbody>
                <tr id="B12345" class="odd">
                    <td>B12345</td>
                    <td>20.3</td>
                    <td>External</td>
                </tr>
                <tr id="B23456" class="even">
                    <td>B23456</td>
                    <td>19.6</td>
                    <td>Internal</td>
                </tr>
                <tr id="B34567" class="odd">
                    <td>B34567</td>
                    <td>22.0</td>
                    <td>Internal</td>
                </tr>
            </tbody>
        </table>

Table Css:

tr.odd { background-color: #F9F9F9; }
tr.even { background-color: white; }
tr.curChecked {background-color: #33CC33; }

jQuery attempt:

$('#checkinProcess').submit(function(e){
    e.preventDefault();
    $("tr.processBarcode").removeClass("odd" "even").addClass("curChecked");
});

How do I pass the barcode scanned in the form to my JQuery to identify which tr tag’s class I want changed? Can I even do that?

Thanks

  • 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-16T02:17:29+00:00Added an answer on June 16, 2026 at 2:17 am
    <script>tr.curChecked {background-color: #33CC33; } </script>
    
    <form id="checkinProcess" class="mainForm" method="post" action="">
      <label>Barcode:</label>
      <input type="text" class="required" name="barocode" id="processBarcodes" />
      <input type="submit" value="submit" class="blueBtn" id="submitBtn" />
    </form>
    
    <div class="table">
      <table class="display" id="testTable">
        <thead class="tableheader">
          <tr><th>No</th><th>Name</th><th>Age</th><th>Salary</th></tr>
        </thead>
        <tbody id="testBody">
          <tr id="B000506" ><td>1</td><td>Abe</td><td>28</td><td>$100K</td></tr>
          <tr id="B000501" ><td>2</td><td>Jimmy</td><td>29</td><td>$90K</td></tr>
          <tr id="B000506" ><td>3</td><td>Dude</td><td>18</td><td>$50K</td></tr>
          <tr id="B000506" ><td>4</td><td>Boyee</td><td>28</td><td>$40K</td></tr>
        </tbody>
      </table>
    
    <script>
      $(document).ready(function() {
        $("#submitBtn").on("click", highlight);
    
        function highlight(evt) {
          evt.preventDefault();
          var scanbc = $("#processBarcodes").val();
          $("#" + scanbc).addClass("curChecked");
          $("#processBarcodes").val('');
          $("#processBarcodes").focus();
    </script>
    

    Worked.

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

Sidebar

Related Questions

I have a dynamically generated table and for each row in the table there
i want to post dynamically generated multiple text box using php by foreach loop.
I have a form with a dynamically-generated group of fields - backend is php/mySQL,
I have a PHP form for discussions. Each message has its own response button,
I hava a dynamically generated image on my page like so: <img id=my_image src=data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEA/gD+AAD/etc............
I am looking to build a single page with 1000+ pages, dynamically generated from
I have a large, dynamically generated, single page website that heavily relies on javascript.
I have a dynamically generated page with varying number of items (div.item). Each item
How to handle dynamically generated form submit in asp.net mvc? Form is dynamically created
I have a trivia page that is dynamically generated by some javascript code. It

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.