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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:44:02+00:00 2026-06-11T20:44:02+00:00

I have the following code that generates a table: <table class=table table-bordered table-striped id=assignedvs>

  • 0

I have the following code that generates a table:

  <table class="table table-bordered table-striped" id="assignedvs">
      <thead>
          <tr>

              <th>VlId</th>
              <th>Name</th>
              <th>Status</th>
              <th>Voice</th>
              <th>Jumbo</th>
              <th>Mode</th>
          </tr>
      </thead>
      <tbody>

          <?php foreach ($vln as $vlndetail): ?>
              <tr>          
                     <td id='vlid'><?php echo $vlndetail['VlId'] ?></td>
              <td><?php echo $vlndetail['Name'] ?></td>
              <td><?php echo $vlndetail['Status'] ?></td>
              <td><?php echo $vlndetail['Voice'] ?></td>
              <td><?php echo $vlndetail['Jumbo'] ?></td>
              <td><?php echo $vlandetail['Mode'] ?></td>
            </tr>
          <?php endforeach ?>

I need to find the row where the VlId matches what the user has specified in a text box. Once I’ve found this record, I want to grab value in the mode column for the particular row.

here’s what i’ve written so far:

    $('#delete').live('click', function()  {

                //get a count of all records. only allowed to delete if you have more than one + the header.
                var reccount = $('#assignedvs tr').length;

                if (reccount > 2)
                {
                    //loop through the table
                $('#assignedvs tr').each(function() {

                    var temp = $(this).find(".vlid").html(); 
                    console.log(temp);  
                                    if (temp == $('#uservalue').val){
                                          //grab mode column
                                     }
                });
                }
                else
                {
                    alert("error: must have at least 1 record.");
                }



    });  

problem – the code i have to reference the vlid column is incorrect. it always prints a null to the console.
Can you tell me what I’ve done wrong?
thanks.

EDIT 1

I changed my id to a class and changed my jquery back to the original code I had. it’s working – except for the fact that I think it’s including the header . I have 4 rows + header. When i check the console results, the first print out is always NULL and then the correct value for the 4 records. how do it get it to ignore the header?

  • 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-11T20:44:04+00:00Added an answer on June 11, 2026 at 8:44 pm

    That’s because you are finding by className, not by id. To find by id, use the following instead:

    $(this).find("#vlid").html();
    

    However, since ids should be unique across the entire document, a better solution would be to maintain your current code, and instead of using <td id='vlid'>, use <td class='vlid'>.

    Also note that val() is a function. Thus, to get the value of a given input, you should use $('#uservalue').val().

    EDIT: To exclude the header, use the $('#assignedvs tbody tr') selector. This way, you only get rows that are descendants of tbody, thus ignoring the header rows, which descend from thead.

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

Sidebar

Related Questions

I have the following SVG source code that generates a number of boxes with
I have following code snippet that i use to compile class at the run
I have a table name Discount that has the following schema: PK DiscountID int
I have the following code that generates the desired HTML. But it prints it
I have the following piece of code that generate a jquerymobile-style button <a href=#
I have following code that I am compiling in a .NET 4.0 project namespace
I have following code that does not work due to a being a value
I have following code that does not work: I never get to goToFoodDetail .
I have the following code that has @item.ID from razor: <a href=# id=deleteitem(@item.ID)>Delete</a> When
I have the following code that gets the MAC address of an interface: static

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.