JQuery 文件附件: 类型错误: $(..) 为空
JQuery file attachment: TypeError: $(...) is null
我有以下代码可以帮助创建自定义选项来附加文件。当我运行代码时,我收到此错误类型错误: $(...( 为空。我出现在它自己的代码的第一行。我正在尝试在票证表格上使用它。有人可以让我知道我的代码中的错误是什么。它在 Zendesk 门户中不起作用。
var frame=$('#upload_frame').html('<iframe></iframe>').find('iframe');
var fileform='<form method="POST" action="/fileuploads?format=js"> Attach log files <input type="file"></form>';
var frameinit=function() {
frame.contents().find('body').children().remove();
frame.contents().find('body').append(fileform);
frame.contents().find('input').change(function(){
frame.contents().find('form').submit();
});
};
frameinit();
$('#SelectFile').click(
function() {
frame.contents().find('input').click();
//Callback to load the result from iframe
frame.load(function() {
//it is just for jsfiddle
var data=frame.contents().find('.pageHeader');
$('body').append($('<div>').html(data));
frameinit();
});
});
我想你还没有包含jQuery库本身。你需要像这样包含它
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
相关文章:
- 错误:ReCAPTCHA占位符元素必须为空
- 表单提交没有'如果为空,则不会显示错误消息
- “语法错误:意外的令牌)”在 javascript 调用中,当 eval(value) 为空时
- 获取错误 a.ownerDocument.defaultView 为空
- 对于Python,获取WebDriverException:消息:u'[JavaScript错误:“e为空”;
- "未捕获的类型错误:无法读取属性'长度'“为空”;在jQuery中
- Firefox SDK:包括jquery.flot在内的问题,错误显示维度高度为空
- 错误:“null”为空或不是IE8中的对象,而不是Chrome或Firefox
- 当两个字段为空时如何显示错误消息 javascript/jquery.
- JavaScript var 分配一个动态可为空的值显示脚本错误
- 在使用日历的产品页面上的 magento 中获取“类型错误:触发器元素为空”错误
- 如果文本区域为空,如何在按回车键时显示错误
- “'$' 为空或不是对象 ” 错误在 ajax 响应中
- 只有Internet Explorer给出错误:“document.getElementById(..)' 为空
- 存储为空或不是 dojo 中的对象错误
- 受信任站点 WinXP IE 8 的错误“window.opener.top 为空或不是对象”
- 解决 dojo 中的“类型错误:节点为空”错误
- 声音云自定义播放器 - “id 属性为空”错误
- 弹出窗体的字段为空错误
- 提交表单时,firebug中出现表单为空错误