Home JS not running inside modal after dynamically change of it's id
Reply: 0

JS not running inside modal after dynamically change of it's id

user993
1#
user993 Published in May 25, 2018, 6:55 pm

I'm using bootstrap modal and I'm calling a autocomplete function inside of it, it all works well when it's set like this:

Button that has a data-target to call the id of the modal:

data-target="#modalAdicao"

And the div with the id set to match the data-target:

id="modalAdicao"

But because it's called inside a PHP foreach and I need keep the information, I have to set the id of the modal like the id of the mysql line I'm dealing with, like this:

data-target="#modalAdicao<?php echo htmlspecialchars($idModal); ?>"

And:

id="modalAdicao<?php echo htmlspecialchars($idModal); ?>"

After this, the information is kept but the js stops working, it's like I never called it, but it's there, like it always been:

<script src="js/procura-paciente.js"></script>

Anyone can help?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306878 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO