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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:51:03+00:00 2026-05-14T22:51:03+00:00

The function below checks whether the id entered is already in the database, and

  • 0

The function below checks whether the id entered is already in the database, and if it is, then it adds some html to the table. I’m not sure if it’s directly related to my issue or not, but, essentially, a user will place the focus on the id input field and enters an id. Using ajax, it posts to a php script and returns data if rows are found and nothing if it doesn’t. If the user then tabs over to the next input field (zipcode), or clicks in another input field, they essentially have to do so twice. The cursor “flashes” in the field briefly and then focuses out. I tried adding in a focus(), but the behavior didn’t change.

So, the html looks like this:

 <table id="tableSearchData" class="searchlist" style="width: 789px;">
        <thead>
            <tr>
                <th>ID</th>
                <th>Zip Code</th>
                <th>Radius (in miles)</th>
            </tr>
        </thead>

        <tbody>
            <tr class="odd">

<!-- PROBLEM is described below -->
<!-- User clicks in <input name="id[]"> and ID is checked -->
<!-- User presses "tab" or clicks in <input name="zipcode[] 
     (in the *same* row) and cursor flashes, then goes out 
     of focus so that the user has to click in the field again -->

                <td class="center sorting_1"><input type="text" value="" name="id[]"></td>
                <td class="center"><input type="text" value="" name="zipcode[]"></td>
                <td class="center"><input type="text" value="" name="radius[]"></td>
            </tr>
        </tbody>
    </table>

Here’s the jquery function… Like I said, I’m not sure if it’s directly related to the problem I’m having, but, thought I should include it because I suppose it’s likely there is something happening there…

$("#tableSearchData > tbody > tr > td > input[name=id[]]").focusout(function() {
                        var row = $(this).closest("tr").get(0);
                        var sData = $(this).serialize();
                        $.ajax({
                                type: "POST",
                                url: "checkid.php",
                                data: sData,
                                success: function(html) {
                                    $(row).replaceWith(html);
                                    $(".preset").each(function() {
                                            $(this).attr("disabled", true);
                                        });
                                        $(row).closest("input[name=zipcode[]]").focus();
                                }
                        });
        });
  • 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-05-14T22:51:04+00:00Added an answer on May 14, 2026 at 10:51 pm

    try:

    $(row).find("input[name=zipcode[]]").focus();
    

    .closest()

    Description: Get the first ancestor
    element
    that matches the selector,
    beginning at the current element and
    progressing up through the DOM tree.

    I believe input[name=zipcode[]] is not an ancestor of the row…

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

Sidebar

Related Questions

I have a function that resembles the one below. I'm not sure how to
I have an XSLT function which checks whether the sent parameter is in YYYYMMDD
The function below prints a color raster image to a PCL-5 printer. The function
The function below is logging the 0, z and the 1 ok... but its
The function below takes a python file handle, reads in packed binary data from
I'm testing the VB function below that I got from a Google search. I
I typically use the below function to return the root URL if I ever
How do I make the below function more dynamic for example commentLink and commentContainer
I'm writing code to do Xml serialization. With below function. public static string SerializeToXml(object
Below is my current char* to hex string function. I wrote it as an

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.