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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:46:26+00:00 2026-05-25T15:46:26+00:00

Can anyone offer more help on this I have the code setup on jsfiddle

  • 0

Can anyone offer more help on this I have the code setup on jsfiddle at…

http://jsfiddle.net/justinerswell/feDTU/

I need to get the last item in the substr and work backwards to populate the fields I need.

Thanks

Original Question

Hi I have a list box returned on a page with multiple result which are being parsed in as a string into the value…

<option value="1 Corn Exchange, The Strand, RYE, East Sussex, TN31 7DB, UNITED KINGDOM">

Using JQuery I need to do a couple of things..

  1. Get Selected Value
  2. Split Value of Selected Item by Comma’s
  3. Loop through in revers and set a variable for each item i.e country: United Kingdom Postcode:TN31 7DB etc

Can anyone help me?

Thanks

  • 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-25T15:46:27+00:00Added an answer on May 25, 2026 at 3:46 pm

    Do you want to fetch the data on click or submit?

        $('select').click( function() {
    
            var selected = $(this).find(':selected').text();
    
            var substr = selected.split(',');
            var product = substr[0];
            var city = substr[1];
            var postcode = substr[2];
            var country = substr[3];
    
            //DO SOMETHING WITH IT??
        });
    

    But its not a very good idea, considering your “data” structure can’t change (ie. missing fields and so on) – since it will break on the indexes….

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

Sidebar

Related Questions

can anyone offer a selector to do away with this horrible chunk of code:
Can anyone suggest a CMS able to offer the following features: Free/open source Support
Can anyone suggest the best way to offer a file for download within a
Can anyone recommend a .NET winforms control that offers similar functionality to the address
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Why does C++ have public members that anyone can call and friend declarations that
I have been working through Microsoft's ASP.NET MVC tutorials, ending up at this page
Can anyone explain to me one or more efficient, reliable methods for opening a
Can anyone explain to me one or more efficient, reliable methods for opening a
Can anyone tell me how I can display a status message like 12 seconds

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.