我正在使用 jqGrid 插件,我想将 onKeyPress 事件添加到编辑表单的每个字段。
此代码适用于 IE8,但在 FF 和 IE7 中失败
{name: 'name', index: 'name', width: 200, editable: true,
sortable: false, search: true, editoptions: { readonly: false, size: 32,
'onKeyPress': 'if($("#cbLanguage").attr("checked"))togeo();' },
editrules: { required: true }}
如何修改它以使其在 IE7 和 FF 中工作?谢谢。
最佳答案
找到解决方案了! 为了将事件分配给字段,我需要将以下内容添加到编辑选项:
dataEvents:[{type:'keypress', fn: function(e) {
if($("#cbLanguage").attr("checked"))togeo(); }}]
关于javascript - 将 javascript 事件添加到 jqGrid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1221693/