从jquery设置样式属性

MEU*_*ULT 0 html css jquery

我正在尝试制作一个脚本,当单击该按钮时,在一个3行按钮的按钮中添加左右边框,否则保持没有边框.我到目前为止的代码是:

$("#popular").click(function(){  
    clearBorders();
    //make borders here (this works)   
}); 

$("#suggestions").click(function(){    
    clearBorders();
    //make borders here (this works)   
}); 

$("recent").click(function(){    
    clearBorders();
    //make borders here (this works)  
}); 

function clearBorders(){
    $('popular').css("border", "solid");
    $('suggestions').css("border", "none");
    $('recent').css("border", "none");
}    
});
Run Code Online (Sandbox Code Playgroud)

我可以很好地创建边框,但由于某种原因,clearborders方法不起作用.我知道正在调用该函数,因为如果我在其开头发出警报,它就会显示出来.为什么这个功能不起作用?

hai*_*sin 6

您的选择器缺少clearBorders()函数中的前导id(#)或类(.)指示符