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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:55:49+00:00 2026-06-08T22:55:49+00:00

I have an ajax form that returns a list and puts it into an

  • 0

I have an ajax form that returns a list and puts it into an HTML table. I plan on using a click event in the Complete section of the ajax call but am unsure how to proceed.

What I need is a method that will be able to:

  1. determine if there are any rows in the table, and
  2. send a click event to that row.

I know how to do the click event, its the dynamic table that’s causing me the pause.
Appreciate the help.

  • 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-08T22:55:52+00:00Added an answer on June 8, 2026 at 10:55 pm

    Didn’t not test it, but this should do the job :

    alert( $('#myTable tr').length )
    

    Put whatever the ID of your table is, class, or whatever and select all sub-elements tr. With the function length, she will return the number of tr inside your table. As you may know, each tr is a row.

    So in final, your code will look like this :

    if( $('#myTable tr').length > 0 ){
        // You have more then 1 row !
        $('#yourBtn').trigger('click');
    }
    

    If you want to click the first row, no matter what you can do this :

    $('#myTable tr:first-child').trigger('click');
    

    However, clicking a row isn’t the best idea since a row ain’t a link. If you want to click a link inside a TD, you can try this :

    // Will find first TR (row)
    // Will go to the TD with the index "1". I think it's the second TD because index start     at 0, but I am not sure anymore.
    // Will find the first link, then trigger it as a "click".
    $('#myTable tr:first-child').find('td:eq(1) a').trigger('click');
    

    Didn’t try the last one so I don’t know if it work.

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

Sidebar

Related Questions

I have a form that I am using AJAX to pass values with. The
I have page, that loads in data using AJAX (a form filter) using jQuery.
I have an Ajax form that updates a div when submitted with a submit
I have an Ajax contact form that links to a jquery file but for
I have a form that I'm submitting through AJAX. The form includes many fields,
I have a form that I'm submitting with AJAX. A user fills out the
I have a contact us form that uses Ajax (i.e. relies on asynchronous requests).
I currently have a PHP form that uses AJAX to connect to MySQL and
In my application I have a drop-down form that fires up an AJAX request
I have a small jQuery plugin that I use for form AJAX validation. There

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.