Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue initializing ajax loaded inputs #11

Open
Braunson opened this issue Jan 26, 2018 · 4 comments
Open

Issue initializing ajax loaded inputs #11

Braunson opened this issue Jan 26, 2018 · 4 comments

Comments

@Braunson
Copy link
Contributor

I'm looking to initialize a second input that's ajax loaded on a page.

First the page loads with one input which get's initiated no problem.
Once the page is finished loading, it will make an Ajax call to include another input that should be initiated and says it is but it doesn't work as expected, nothing happens.

Ideas?

@dericcain
Copy link
Owner

Is there a way that when you dynamically add the inputs that you can, at that time, bind the Address Autocomplete?

@Braunson
Copy link
Contributor Author

@dericgw Yep that's what I'm doing.

@ghost
Copy link

ghost commented Feb 2, 2018

Do you have the code in Github somewhere where I can take a look at it?

@Braunson
Copy link
Contributor Author

Braunson commented Feb 4, 2018

@dericcain Yep https://gist.github.com/Braunson/b1286c2d56e4e0509ea67d19b269cfb3 I'm sure there's room for improvement. The goal was to be able to initialize the autocomplete on any form element with say data-google-autocomplete attribute.

In my use-case I'm using it in a form, there is always a hidden field that get's filled with the default callback's json encoded response so when submitted, we parse that json data and save it without having to show the user anything but a nice formatted address in the field.

I'm open to any suggestions or improvements but it seems when trying to run the plugin on a dynamically inserted input field, it doesn't work. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants