(im still learning about js / jquery) so pls bear with me - I have the following code in a page - If i echo $data, it works perfectly - the words load correctly. But when I echo the modal (containing the same $data) the functionality stops and i just have text typing in the box.
The page has the same includes (its a test page I use for standalone code). Do I need to reload the token js and css files into the modal (tried that but not working) - what am i missing?
There is no extra js for the token input, it just loads the js and css files.
$data='<span class="font-heavy" id="">To:</span>
<input type="text" id="users" name="blah" placeholder="Add friends"/>
<input type="hidden" id="tags"/>
<script type="text/javascript">
$(document).ready(function() {
$("#users").tokenInput([
{id: 7, name: "Ruby"},
{id: 11, name: "Python"},
{id: 47, name: "Java"}
],{
prePopulate: [
/*{id: 123, name: "Pri User"},
{id: 555, name: "Bob Hoskins"}*/
],theme: "facebook",preventDuplicates: true, hintText: "Add friends"
});
});
</script>
';
$modal = '<a href="#" id="NewRatingsLink">Load Modal</a>
<script type="text/javascript">
$(document).ready(function(){
$("#NewRatingsLink").click(function(){
$("#newRatingsModal").modal("show");
});
});
</script>
<style>.modal {
overflow-y: hidden;
}</style>
<div id="newRatingsModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Overall Rating: '.@RatingStars($ave).'</h4>
</div>
<div class="modal-body">
<div id="listratings">
'.$data.'
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-green" data-dismiss="modal">Cancel</button>'.@$submit.'
<div class="message"></div>
</div>
</div>
</div>
</div><!-- END of Modal HTML -->';
Thanks!