我尝试向链接的父 div 添加一个类,如下所示:
$(document).ready(function() {
$(".food-result").on("click", "a", function (event) {
event.preventDefault();
$(this).parent().parent().addclass('active');
return false;
});
我收到错误:
Uncaught TypeError: undefined is not a function
我做错了什么?
最佳答案
addclass
方法名称中存在拼写错误。尝试addClass
。 More details
关于javascript - 尝试在 jQuery 中将类添加到父级时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26445988/