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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:19:03+00:00 2026-06-02T05:19:03+00:00

please run this jsfiddle as an example. http://jsfiddle.net/AFzqt/11/ in my example, i have a

  • 0

please run this jsfiddle as an example.

http://jsfiddle.net/AFzqt/11/

in my example, i have a link saying same as above, if you fill out the first box it will copy the value in the second box. look at the code, and look at the display. theres a reiteration of the code just to have the boxes appear twice. well… in my real use of this, i ideally want there to be about 40 of these buttons.

is there a way to do this without copying the code 40 times?
i am new to jquery, usually in another language i would just pass in arguments, but with this syntax I don’t see how i can do that? how can i handle this?

feel free to dabble around on my jsfiddle, and hopefully link a new revision, with the goal of reducing the handling of those 2 ‘same as above’ buttons into just one function with the entry id’s as parameters

  • 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-02T05:19:05+00:00Added an answer on June 2, 2026 at 5:19 am

    If you add the changeButton class to each of the buttons it will be easier to select each of them to bind the event handler:

    <a href="#" class="changeButton">Same as Above</a>
    

    Then we can select each of the elements like so:

    $(".changeButton").on("click", function(e) {
    
        //select the previous jQuery Mobile select widgets, we will use just the previous two
        var $allPrev = $(this).prevAll('.ui-select').find('select');
    
        //change the value of the immediate previous select widget to the value of the one preceding it
        $($allPrev[0]).val($($allPrev[1]).val()).selectmenu("refresh");
    
        e.preventDefault();
    });
    

    Here is a demo: http://jsfiddle.net/AFzqt/12/

    This code will work for umpteen buttons since it works by using intuitive knowledge of the HTML structure (each link uses the previous two select widgets, no matter where on the page the link resides).

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

Sidebar

Related Questions

Please run this test on firefox. http://jsperf.com/static-arithmetic How would you explain the results? This
Can anyone please tell me how do I make this script run in IE
Please have a look at http://500px.com/photo/3977429?from=popular . Down in the right corner, theres a
Will any one please tell me how to run this class. I am getting
Please run this code, and explain me why the output is like: table[0]=3 table[1]=-858993567
Whenever I run this code, I get a same result. Program #include<stdlib.h> int main(int
Please read Update1 first! This is SSIS specific question. I have the following tasks:
This question is related to this question yesterday . Please see current jsfiddle here
im currently makeing some form you can see at http://jsfiddle.net/AnMSa/ it is working fine
When I run this am getting resource #id 3 result. Please look into my

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.