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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:16:16+00:00 2026-05-26T18:16:16+00:00

I have a set of checkboxes that each have a drop down associated with

  • 0

I have a set of checkboxes that each have a drop down associated with it. When the user clicks the checkbox, the checkbox value and it’s drop down is sent to the server.

I originally had each in a ul, but changed it to a table to keep the dropdowns lined up. After I did that, the next function stopped working. The var in the request even disappears. If I hard code a value, it shows back up.

Here is the function:

$(document).delegate('.cbxAmenity', 'click', function() {
    $("#dialogNotify").append(" Saving...").dialog();

    var thisAmenity = (this.id).replace("AmenityList_", "");

    $.ajax({
        url: 'ajax_url.php',
        dataType: 'json',
        data: {
            ResortId: $("#id").val(),
            action: 'save',
            amenity: thisAmenity,
            locality: $(this).next().val() // if i change to 'foo' it works
        },
        success: function() {
            $("#dialogNotify").dialog("close");
            ui.amenityDialog();
        },
        error: function() {
            $("#dialogNotify").html("There was an error saving amenity");
        }
    });

EDIT: Here is the table…its generated by another ajax call:

$("#dialogAmenity").html("<table id='amenityList'><tr><th>Amenity</th><th>Locality</th></tr>");
                for(var index=0; index<amenities.length; index++) {
                    $("#amenityList").append("<tr><td><input type='checkbox' name='AmenityList_"+
                                             amenities[index].AmenitiesID + "' id='AmenityList_"+
                                             amenities[index].AmenitiesID + "' class='cbxAmenity' /> "+
                                             amenities[index].Name +
                                             "</td><td><select id='locality' name='locality'>"+
                                             "<option value='RESORT'>Resort</option>" +
                                             "<option value='NEARBY'>Near by</option>" + 
                                             "</select></td></tr>");

                    if (amenities[index].link == true)
                        $("#AmenityList_"+amenities[index].AmenitiesID).prop('checked', true);

                }
                $("#dialogAmenity").append("</table>");

EDIT AGAIN: Here is the html from Firebug

<table id="amenityList">
  <tbody>
    <tr>
      <th>Amenity</th>
      <th>Locality</th>
    </tr>
    <tr>
      <td>
        <input name="AmenityList_1" id="AmenityList_1" class="cbxAmenity" type="checkbox"> Indoor Pool
      </td>
      <td>
        <select id="locality" name="locality">
          <option value="RESORT">Resort</option>
          <option value="NEARBY">Near by</option>
        </select>
      </td>
    </tr>
    <tr>
      <td>
        <input name="AmenityList_2" id="AmenityList_2" class="cbxAmenity" type="checkbox"> Fitness Gym
      </td>
      <td>
        <select id="locality" name="locality">
          <option value="RESORT">Resort</option>
          <option value="NEARBY">Near by</option>
        </select>
      </td>
    </tr>
    <tr>
      <td>
        <input name="AmenityList_3" id="AmenityList_3" class="cbxAmenity" type="checkbox"> Beach Access
      </td>
      <td>
        <select id="locality" name="locality">
          <option value="RESORT">Resort</option>
          <option value="NEARBY">Near by</option>
        </select>
      </td>
    </tr>
    <tr>
      <td>
        <input name="AmenityList_4" id="AmenityList_4" class="cbxAmenity" type="checkbox"> Laundry Room
      </td>
      <td>
        <select id="locality" name="locality">
          <option value="RESORT">Resort</option>
          <option value="NEARBY">Near by</option>
        </select>
      </td>
    </tr>
  </tbody>
</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-26T18:16:17+00:00Added an answer on May 26, 2026 at 6:16 pm

    The element with class cbxAminity is the last element in the <td> tag. Therefore, it does not have a next() element. You need to do

    $(this).parent().next().find('select').val();

    in order to find the <select> element in the next <td>.

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

Sidebar

Related Questions

I have sets of checkboxes and a rotated h4 next to each set. I'm
I've got a sequence of checkboxes on a C# Winform. Each checkbox can have
I have a view model with a from that includes a set of checkboxes.
Brief: Based on a query, I have multiple checkboxes generated dynamically. The value of
My project is WinForms, C#. I have a form with TreeView with CheckBoxes set
I have a pretty large form that consists of radio buttons/checkboxes as well as
I've got a set of checkboxes that are added to a document via an
I have a list of checkboxes that look like below, the numbers, 416, 419,
I have a form with multiple rows of checkboxes, each with a specific id,
i have 2 drop downs in my UI,selecting one would give another set of

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.