Skip to content

Instantly share code, notes, and snippets.

@superfine
Created October 11, 2015 18:15
Show Gist options
  • Save superfine/82c18ee29f0e9b7f354d to your computer and use it in GitHub Desktop.
Save superfine/82c18ee29f0e9b7f354d to your computer and use it in GitHub Desktop.
removes the value from the search input with non-jQuery JavaScript
// removes the value from the search input with non-jQuery JavaScript
function freez(obj) {
var id = obj.id;
if (obj.value == '') {
obj.value = defaultSearchValue[id];
} else if (!defaultSearchValue[id]) {
defaultSearchValue[id] = obj.value;
obj.value = '';
} else if (obj.value == defaultSearchValue[id]) {
obj.value = '';
}
}
// hint: search inputs need an id to function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment