The `output_javascript` class can just be added in the statement two lines up:

```
var element = $("<div/>").addClass("output_subarea output_javascript");
```