Refactored generate style logic to use jQuery objects instead of css text.