简体   繁体   中英

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 ***********************/

Hello Gautam change this code

from

source:[states]

to

source:states

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM