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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:59:38+00:00 2026-05-27T18:59:38+00:00

I apologize for the messy script and tags, I am just a beginner. I

  • 0

I apologize for the messy script and tags, I am just a beginner. I want to select the text in the div with the class “reserveAPickupAppointmentLocation. This div is inside $(this). $(this) is the selected entry out of many. The line that is relevant is:

var location = $(".reserveAPickupAppointmentLocation, this").text();

This returns the location from all entries, instead of just from $(this). How do I get only what I want?

Full jquery function:

   $(".reserveAPickupAppointmentRoommateAppointment").click (function() {
    if ($(this).hasClass("confirm")) {
    }
    else {
        $("img").remove(".confirmAppointment");
        $(".reserveAPickupAppointmentRoommateAppointment").removeClass("confirm");
        $(this).addClass("confirm");
        $(this).append("<img src=images/confirmAppointment.png class=confirmAppointment id=roommateAppointment>");
            $(".confirmAppointment").click (function() {
                $(".confirmAppointment").unbind("click");
                var location = $(".reserveAPickupAppointmentLocation, this").text();
                alert (location);
            });
    }
   });

relevant php part

echo '<table>';
while ($row = mysql_fetch_array($result)) { 

echo
'<tbody class = "reserveAPickupAppointmentRoommateAppointment">
    <tr>
            <td>'
                .$row["name"].
            '</td>
            <td>
                <span class = "reserveAPickupAppointmentLocation">'
                    .$row["location"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentSubLocation">'
                    .$row["subLocation"].
                '</span>
            </td>
        </tr>
        <tr>
            <td>
                <span class = "reserveAPickupAppointmentStartTime">'
                .$row["startTime"].
            '</span>    - 
            <span class = "reserveAPickupAppointmentEndTime">'
            .$row["endTime"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentDate">'
                .$row["date"].
                '</span>
            </td>
        </tr>
    </tbody>';
}

echo '</table>
  • 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-27T18:59:38+00:00Added an answer on May 27, 2026 at 6:59 pm

    To pass a second parameter to a jQuery selector as the context in which to search, you’ll need to close your quotes first.

    var location = $(".reserveAPickupAppointmentLocation", this).text();
    

    BUT

    The value of this in your click callback will change value, so you’ll need to save it beforehand.

    $(this).append("<img src=images/confirmAppointment.png class=confirmAppointment id=roommateAppointment>");
    var self = this;
    $(".confirmAppointment").click (function() {
        $(".confirmAppointment").unbind("click");
        var location = $(".reserveAPickupAppointmentLocation", self).text();
        alert (location);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize if this is a really beginner question, but I have not worked
I apologize is this is a duplicate and I just could not phrase the
I apologize if this question is too basic, but I just can't figure out
I apologize if this question is listed elsewhere and I just didn't find it
I apologize if this code looks a bit like a mess (considering the length);
I apologize if this is slightly off-topic. I'm hoping to find a software-as-a-service CRM
I apologize in advance if this question seems remedial. Which would be considered more
I apologize for the subjectiveness of this question, but I am a little stuck
I apologize in advance if this question seems confused. The behaviour I am seeing
I apologize before hand if this is an obvious question: can Apache 2.0 +

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.