5075 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says

I asked the question on Stack

Weirdly no replies, so either I have stumbled across cutting edge technology, I asked a stupid question or all the jQuery guys are watching 2 and 1/2 men !

Any ideas, on a fix for this issue plz. :) You will be rewarded with virtually anything you ask for.

2821 posts
  • Australia
  • Community Moderator
  • Elite Author
  • Author had a Free File of the Month
  • Most Wanted Bounty Winner
  • Author had a File in an Envato Bundle
  • Has been a member for 5-6 years
  • Contributed a Blog Post
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+10 more
dtbaker Volunteer moderator says

can you just try change() as well?

function update_user_type(inputbox){
  $(".adburb").html($(inputbox).val());
  return false;
}
$("#suburb").keyup(function(){ update_user_type(this); }).change(function(){ update_user_type(this); });

if jquery autocomplete fires the change then that’ll work. if that doesn’t work then you’ll have to hunt through the autocomplete code to see if there is a callback function that is run after selecting an item

44 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Bought between 1 and 9 items
  • United Kingdom
  • Exclusive Author
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1000 and 1999 users
designchemical says

autocomplete has a “select” callback function:

http://api.jqueryui.com/autocomplete/#event-select
5075 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says

Hmm.. looks like I am gonna have to hunt thru jquery ui lol ( oh fun )

Cheers Dave

5075 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says

autocomplete has a “select” callback function: http://api.jqueryui.com/autocomplete/#event-select

I am not sure how to test that, beyond my capability. Will play tho, thankyou

2821 posts
  • Australia
  • Community Moderator
  • Elite Author
  • Author had a Free File of the Month
  • Most Wanted Bounty Winner
  • Author had a File in an Envato Bundle
  • Has been a member for 5-6 years
  • Contributed a Blog Post
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+10 more
dtbaker Volunteer moderator says

autocomplete has a “select” callback function: http://api.jqueryui.com/autocomplete/#event-select

perfect!

so leave your original code and wack this in somewhere:

$( "#suburb" ).on( "autocompleteselect", function( event, ui ) {
  $(".adburb").html($("#suburb").val());
} );
44 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Bought between 1 and 9 items
  • United Kingdom
  • Exclusive Author
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1000 and 1999 users
designchemical says

Using “close” may be better since this will fire after the menu closes and the value updated (I presume):

$("#suburb").autocomplete({
    close: function(event, ui) {
        $(".adburb").html($("#suburb").val());
    }
});

Edit: Sorry, didnt see the previous reply.

5075 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says

So I created a fiddle. ( based off someone elses code )

And replicated the issue we have: http://jsfiddle.net/qb59C/45/

update: working http://jsfiddle.net/qb59C/46/

PERFECT

Cheers Guys xxxxxxx

44 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Bought between 1 and 9 items
  • United Kingdom
  • Exclusive Author
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1000 and 1999 users
designchemical says

Or just change the original autocomplete function to:

$(function () {
    $("#suburb").autocomplete({
        source: ['England', 'Germany', 'Denmark', 'Sweden', 'France', 'Greece', 'Italy'],
        change: function (event, ui) {
            if (!ui.item) {
                this.value = '';
            }
        },
        close: function(event, ui) {
            $(".adburb").html($("#suburb").val());
        }
    });
});
5075 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says

The code is actually a tad more complex than my example, essentially, we retrieve ( via json ) from our db, suburb postcode and state.

So now to figure out how to propagate the bloody state and postcode, but will get there.

Cheers Guys ( its only for a poxy form, and only becuase we want to display a clients ad preview lol )

But UI is kind of an anal passion of mine

by
by
by
by
by
by