I believe the .addClass() function in jQuery attaches a CSS class to the current selection, but I was wondering I could create or define a CSS class in jQuery, and then atta
With jQuery.Rule you can write code like this to append a new CSS rule:
$.rule('#content ul{ border:1px solid green }').appendTo('style');
Extending a rule:
$.rule('#content ul', 'style').append('background:#FF9');
Removing the whole rule:
$.rule('#content ul', 'style').remove();
There is more in the API docs.
Internally, it uses the "append stylesheet to head" trick that MooGoo mentioned as well.