我在自己的项目中使用aspnetmvcturbolinks,但是在body中编写的jquery没有定义。我把js文件移到布局的头。
$(document).on('keyup', 'input[name=keyword]', function () {
alert(this.attr("name"));
return false;
});在上面的代码中,attr是undefind!什么是解决办法?谢谢。
发布于 2015-01-30 11:06:46
这是因为必须将this传递给jQuery才能使用jQuery方法.
$(this).attr("name")..。否则,它将查看对象并返回未定义的
https://stackoverflow.com/questions/28234519
复制相似问题