I have the following code to fill the suchfeld <input>
with "Suche..."
.
$(function() {
var suchfeld = $("#suchfeld");
suchfeld.on("focus", function() {
if( suchfeld.val() == "Suche..." ) {
suchfeld.val("");
}
});
suchfeld.on("blur", function() {
if( suchfeld.val() == 0 ) {
suchfeld.val("Suche...");
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="suchfeld" type="text"/>
The problem is that after the user has the site loaded with the suchfeld <input>
and the site is in the cache of browser, if the user comes back to the loaded site the <input>
is empty without "Suche..."
.
What can I do?