Gautam Jha
Gautam Jha

Reputation: 1473

jQuery autocomplete plugin not working in ajax loaded contents

jQuery Demo Page

I am getting problem to get auto suggestion of country for contents loaded by AJAX. inside those ajax loaded forms.

I search to fix this problem everywhere but I get some post for auto suggestion form server. I am not using SERVER suggestion of jQuery autocomplete plugin. Can somebody solve this problem??

/********************************** local start ******************/
var states = [
    'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
    'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',
    'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',
    'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
    'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',
    'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',
    'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',
    'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',
    'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
];

$('#name1').autocomplete({
    source:[states]
});

$('#name').autocomplete({
    source:[states]
});
/*********************************** local end ***********************/

Upvotes: 1

Views: 216

Answers (1)

Rakesh Sojitra
Rakesh Sojitra

Reputation: 3658

Hello Gautam change this code

from

source:[states]

to

source:states

Upvotes: 1

Related Questions