(即時通訊仍然在學習js/jquery)所以請耐心等待 - 我在頁面中有以下代碼 - 如果我回顯$ data,它的工作完美 - 文字加載正確。但是,當我回顯模式(包含相同的$數據)功能停止,我只是在文本框中輸入文字。TokenInput在加載到引導模式時停止工作
頁面具有相同的包含(它是我用於獨立代碼的測試頁面)。我是否需要將令牌js和css文件重新加載到模式中(嘗試過但不工作) - 我錯過了什麼?
對於令牌輸入沒有額外的js,它只是加載js和css文件。
$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: '[email protected]($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>'[email protected]$submit.'
<div class="message"></div>
</div>
</div>
</div>
</div><!-- END of Modal HTML -->';
謝謝!
可能重複的[jQuery TokenInput:令牌不會被添加](http://stackoverflow.com/questions/23677002/jquery-tokeninput-tokens-are-not-getting-added) – Chris