Here is what I’m trying to do:
I have a simple input field, if it has an empty value, on focus, I want to give it a value of 12345.
The issue is that once the value becomes 12345, and I put anything (e.g. 7890) after it, click ouside, click back inside, it removes the 7890.
How can I have the 7890 or anything after that act as the value so it does not get erased on blur and focus?
You had focus function bind and the check for a blank val swapped.
Try this:
EDIT: Updated the code to remove the redundant each function based on @karim79’s comments
Working example: http://jsfiddle.net/4VYpV/1/