0
函數通過$ .post使用數據類型HTML加載「.content」中的HTML。加載的內容有選擇2 jquery插件。當網頁加載完畢後第一次它工作正常,在選擇二插件被執行,但如果我回去再重新裝回,然後我得到錯誤
TypeError: $(...).select2 is not a function
我的代碼,加載Ajax是
(".body .content").on("click", ".process_record", function(e){
var url = $(this).attr("data-url");
$.post(url, function(data){
$(".body .content").html(data);
},"html");
})
其內容IAM裝載到$。員額
<script type='text/javascript' src='js/plugins/jquery/jquery-1.9.1.min.js'></script>
<script type='text/javascript' src='js/plugins/bootstrap/bootstrap.min.js'></script>
<script type='text/javascript' src="js/plugins/select/select2.min.js"></script>
<script type="text/javascript">
$(".select").select2();
</script>
一些HTML ....和
<select name="bank_id" class="select" style="width: 100%;" tabindex="1">
<option value="0">Select...</option>
<option value="1">Option</option>
</select>