0

I have already had great help of this piece of code. I am trying to now update another textbox when a jquery autocomplete option is picked.

I made a couple of changes specifically to display two of the options in the multi dimensional array:

a = $.map(a, function (x) {
                    return {
                        label: x.suburb + " - " + x.postCode,
                        value: x.suburb,
                        suburbDetails: x
                    };

The second change however breaks it and I cannot workout what form this line of code needs to be to pick and place the postcode in the #postcode textbox.

I have a Jsfiddle where it works (as an aside css doesnt work either here or in the project select eg "b") when the line is commented out but crashes when its uncommented.

$("#Postcode").val(data.suburbDetails.postCode)

How would you update the postcode textbox with the associated postcode for the suburb given both are/should be accessable via "data.suburbDetails"?

3
  • 1
    jsfiddle.net/q8oLc6ec/9 Commented Apr 11, 2016 at 5:23
  • 1
    Yep that worked - spent ages on that one.. thankyou. Commented Apr 11, 2016 at 5:26
  • happy to help you..;) Commented Apr 11, 2016 at 5:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.