$('#div1,#div2').attr('class','waring');这个是对的,还有一种就是多个DIV你可以给他们加一些无用的属性比如:
$('#div1,#div2').attr('class','waring');已测试
这个很简单,最好给出html代码好帮你改