I'm not quite sure if this is possible or not, I'm pretty knowledgeable when it comes to jQuery and JavaScript in general, but I have a dead end. I created a simple plugin that clears text input in focus and then displays the default value if nothing has been entered.
Is it possible to release only text inside the text input, and not the entire field itself? All attempts seem to lead to the fact that the text field itself disappears and ultimately hides the element from presentation.
I came up with the decision to use intervals containing the default value and absolutely positioning them according to the text input, hiding and showing them depending on whether the user entered any text or not. I would prefer a very simple approach, if one exists.
Edit
Using the jQuery animation function, which is located in the jQuery user interface or is available as a plug-in for jQuery, you can animate the text color as the input color when focusing and blurring the field (as described below). Here is the code that I use in case you want to know how to do this.
obj.bind("focus", function() { if ($(this).val() == oldValue) { $(this).animate({ color: '#E8DFCC' }, 1000).val(''); } }); obj.bind("blur", function() { if ($(this).val().length <= 3) { $(this).animate({ color: '#56361E' }, 600).val(oldValue); } });
javascript jquery frameworks
Dwayne charrington
source share