请帮助我不断返回TypeError$(..)为null
Please help I keep getting back a TypeError $(...)is null
我的老师制作了一个js文件,告诉我们找到错误并修复它们。但是,我陷入了困境。
//this function is called when the user enters invalid data into the form and hits the calculate button
function clearField(field_name) {
//set the value of the passed in field name to blank
$("field_name").value = "";
$("field_name").value = ""; keeps returning an error message like this:
TypeError$(…)为空
对不起,我在事故中用引号做了这件事。我把它重新命名为$(field_name).value == ("");
,它起作用了。
由于field_name
是函数的参数,因此不应将其括在引号中。
应该是:
仅$(field_name).value() = ";
编辑
我的坏。它应该是$(field_name).val("");
而不是
相关文章:
- jquery TypeError: Response is null
- 在javascript中,我正在使用EventListener,并且我得到了TypeError xyz = null
- Quicksort.js未捕获的typeError无法读取null的属性
- Uncaught TypeError:对象原型在Symfony 2中只能是Object或ExtJS为null
- 为什么TypeError:document.getElementById()为null
- TypeError (null reference exception) when using dom-construc
- Rails JavaScript 包含 TypeError:“null”不是一个对象(评估 'document.
- getElementById TypeError: “无法将属性'innerHTML'设置为null
- Ember JS : uncatch TypeError: 無法讀取 null 的屬性 'createRecor
- TypeError: this.element is null, Rails with Judge gem
- TypeError:超级表达式必须是 null 或函数,而不是使用 Babeljs 未定义
- TypeError: jasmine.getEnv().currentSpec is null
- gapi.auth.authorize: TypeError: cv(...) is null
- pdfmake.js uncatch TypeError:无法读取 null 的属性“length”
- Javascript TypeError: document.getElementById(...) is null
- JavaScript :TypeError: document.getElementById(...) is null
- ng-repeat TypeError: 無法讀取 null 的屬性 'insertBefore'
- JavaScript TypeError:无法读取 null 的属性“style”
- TypeError: document.getElementById(..) 为 null - 错误消息
- Javascript 错误:TypeError:“null”不是 safari 上的对象(评估“event.target