A Better Default Value jQuery Plugin

Recently I forked Doug Neiner's inFieldLabels plugin to try and make it a little bit more automatic than it was, which has proved to be problematic. After having used my fork in a couple of sites, I have found that it is more trouble than it's worth to do the absolute positioning like I did. It specifically doesn't work well when things are moving on the screen, such as expanding hidden DOM elements, which cause the label to stay put while the form element moves. I thought about fixing it to detect those kinds of movements and handle some other edge cases that were reported to me, but I felt like the plugin was going to get way more complicated than it needed to be to accomplish a seemingly simple task. I was very happy to find Jan Jarfalk's Defaultvalue plugin, which is a much simpler implementation and works like a champ. No special styling or DOM elements required. It accomplished what I wanted to do in a much more elegant manner. I have successfully replaced inFieldLabels with it on my projects and I am no longer experiencing any of the styling or positioning hassles. There was one quirk with it though. Since it actually fills in an input field with the default value, if that value is present in the field when it posts, that value will be sent to the server. I made a minor update to it to account for this and submitted it back to the author. I hope he incorporates it into his plugin, but we'll see. In the meantime, you can patch it by chaining in the following code to line 37 right after the call to focus, which will cause it to clear the default upon form submit if it is still present in the field. [js] //end of focus event }).closest("form").submit(function() { self.val() == defaultValue && self.val(''); }); [/js] There is some additional nit-picky cleanup that could be done in the plugin as well, but overall it looks, and more importantly works, very good. Kudos to Jan for putting it together and sharing it!