gpt4 book ai didi

javascript - jtable 的验证引擎无法工作 Uncaught TypeError : $(. ..).live 不是函数

转载 作者:行者123 更新时间:2023-12-02 15:27:15 25 4
gpt4 key购买 nike

我正在使用一个使用 PHP+jTable+twig 模板的网站。当我使用validationengine添加一些验证时,使用chrome的开发工具时出现错误

"Uncaught TypeError: $(...).live is not a function"

"Uncaught TypeError: form.find(...).not(...).die is not a function"

我遵循 http://www.jtable.org/Demo/UsingWithValidationEngine2 上的所有说明

我已经包含用于验证引擎的 Javascript 和 CSS 文件

{% block template_libs_js %}
{{ parent() }}
<script src="{{ theme_path }}plugins/jQueryUI/jquery-ui.min.js"></script>
<script src="{{ mdasset_path_js }}jquery.jtable.js"></script>
<script src="{{ mdasset_path_js }}jquery.validationEngine-en.js"></script>
<script src="{{ mdasset_path_js }}jquery.validationEngine.js"></script>
{% endblock %}

对于CSS

{% block head %}
{{ parent() }}
<meta name="description" content="Halaman Master Data yang hanya dapat diakses oleh administrator">

<link href="{{ core_asset_path_css }}jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="{{ mdasset_path }}themes/metro/blue/jtable.css" rel="stylesheet" type="text/css" />
<link href="{{ mdasset_path_css }}validationEngine.jquery.css" rel="stylesheet" type="text/css" />

{% endblock %}

这是我的主要代码

{% block template_js_jquery %}
{{ parent() }}
//Prepare jTable
$('#cntRefAsisten').jtable({
title: 'Ref. Asisten',
paging: true,
sorting: true,
defaultSorting: 'nama_asisten ASC',
selecting: true, //Enable selecting
multiselect: true, //Allow multiple selecting
selectingCheckboxes: true, //Show checkboxes on first column
//selectOnRowClick: false, //Enable this to only select using checkboxes
actions: {
listAction: '{{ site_url() }}masterdata/ref_asisten/fetch',
createAction: '{{ site_url() }}masterdata/ref_asisten/add',
updateAction: '{{ site_url() }}masterdata/ref_asisten/save',
deleteAction: '{{ site_url() }}masterdata/ref_asisten/del'
},
fields: {
id: {
key: true,
create: false,
edit: false,
list: false
},
nama_asisten: {
title: 'Nama Asisten',
width: '30%',
inputClass: 'validate[required]'
},
keterangan: {
title: 'Keterangan',
type: 'textarea',
width: '20%'
}
},
//Initialize validation logic when a form is created
formCreated: function (event, data) {
data.form.validationEngine();
},
//Validate form when it is being submitted
formSubmitting: function (event, data) {
return data.form.validationEngine('validate');
},
//Dispose validation logic when form is closed
formClosed: function (event, data) {
data.form.validationEngine('hide');
data.form.validationEngine('detach');
}
});

//Load list from server
$('#cntRefAsisten').jtable('load');
{% endblock %}

最佳答案

.live() 已弃用,自 jQuery 1.7 起就已弃用。您应该使用 .on()

$("#a").live("click)......

应改为

$("document").on("click","#a",function() {
....
});

关于javascript - jtable 的验证引擎无法工作 Uncaught TypeError : $(. ..).live 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33591681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com