使用jquery添加css规则

我有这样的CSS规则:
#imgwrapper {display: block;position: relative;width:auto;height:auto;}

所以我得到了一个链接,当它被点击时,它应该向#imgwrapper添加一个css规则,如下所示:

#imgtarget,#imgwrapper img {cursor:crosshair;}

我该怎么办?

我试过jquery .css()api但它没有工作..

解决方法

$.css() function
$('a.whatever').click(function() {
  $('#imgtarget').css('cursor','crosshair');
  $('#imgwrapper img').css('cursor','crosshair');
});

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...