I've since realised that this is a pretty shitty way of doing things - relying on placeholder attributes rather than labels not only means that things aren't particularly great for accessbility, but we're also really limiting things in terms of browser compatability (for Internet Explorer users, placeholder attributes have only been introduced in IE10).
Please see FloatLabel.js for a better version of what I was trying to achieve and for something more inline with Matt D. Smith's original concept.