jQuery Quick Tip: Select text on focus
Just a quick tip on how to select all text when focus is given to a textarea or input (only if the value has not changed) .
$("input, textarea").focus(
function()
{
// only select if the text has not changed
if(this.value == this.defaultValue)
{
this.select();
}
}
)
Comments
My problem solved, hehe :D