The first parameter attrshould be the attribute name, not the current value:
$(function accept() {
$("div#scrollwrap").attr('id','highlight');
});
However, after reading your jsFiddle code, you have a highlight class, not an identifier. Here is my edited version with what I think you are trying to achieve.
Please note that I have changed the following:
- Made the .hightlight class more specific by adding an identifier, otherwise the selection style will not override the original.
- onClick, script, (. JS
.click()) - JS , , , .
( jQuery):