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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:21:49+00:00 2026-06-17T10:21:49+00:00

I have an array of drop-downs in a page, one for each row in

  • 0

I have an array of drop-downs in a page, one for each row in a list of records.
I need to update a DIV’s content in the row of the drop-down that triggers each change event.

Something like this:

<div class="price"></div>

<select id="plan[]" name="plan[]" class="sel">
  <option value="0" selected="selected">None</option>
  <option value="1">One</option>
  <option value="2">Two</option>
</select>   


$(function() {
    $('#plan').change(function(){
        $(this).prevAll('.price:first').html('foo bar');
    });
});

The change event never fires, what am I missing? Here’s a fiddle to test

  • 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-17T10:21:50+00:00Added an answer on June 17, 2026 at 10:21 am

    Try using startswith wild card with id selector.

    Live Demo

    $(function() {
        $('[id^=plan]').change(function(){
            $('.price:first').html('foo bar');
        });
    });
    

    If you have single item and do not need wild card you can do it with id selector like this.

    Live Demo

    $(function () {
      $('[id="plan[]"]').change(function () {
        $(this).prev('.price').html('foo bar');
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Drop Down List with check box in my asp.net page. in that
In a PHP page I have a drop-down list that triggers the jQuery change
I have to make a form with multiple drop-down menus that modify one another.
I have a page that shows 3 drop-down selectors on the page. I also
I have a drop down list (yii framework) , that i would like to
I have a select/drop down in my HTML page which has to appear about
I have a drop down list that is generated from values in a table,
I am using the css/javascript drop-down menu from this page: http://javascript-array.com/scripts/simple_drop_down_menu/ Though I would
I have a large multidimensional array and I basically want to drop the first
I have several select lists on a page. They are all named in array-fashion

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.