Move labels to placeholder if the browser supports it

http://forrst.com/posts/Move_labels_to_placeholder_if_the_browser_suppor-UYl

HTML

<form action="#" method="post">
         <label for="name" title="ie: john smith">Name:</label>
         <input type="text" name="name" id="name" placeholder="hmm" value="" tabindex="1" />
</form>

CSS

form{margin:10px;}
form input{padding:4px;}

JavaScript

var placeholder_test = document.createElement('input');
if ('xplaceholder' in placeholder_test) {
    $("form").find("label").each(function() {
        $(this).nextAll("input[type=text], input[type=password]").attr("placeholder", $(this).attr("title"));
        //$(this).hide();
    });
}