/ Published in: JavaScript
Click on an input field with a prefilled value, if that value equals the default then select it, if not leave it as it was. Relies on jQuery.
Expand |
Embed | Plain Text
$("input[name=forname], input[name=surname]").focus(function(){ var defaultText = $(this).val(); if(defaultText === "Forename" || defaultText === "Surname"){ $(this).select(); } });
You need to login to post a comment.
