conditional assignment

The following submit buttons have a different colour based on the length of their "value" attribute (the text they display).

They should look like this:

And here are the same classes dynamically assigned (if jquery scripting is correct these should match the three above)

And the same again but with text values instead of 1234 (again, should match the first series above)