tips:default_text_search
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tips:default_text_search [2010-11-13 00:17] – make sure the default text isn't searched 137.71.23.54 | tips:default_text_search [2013-09-18 22:05] (current) – Update to use placeholder attribute Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Adding default text for the search box ====== | ====== Adding default text for the search box ====== | ||
- | Just copy/paste this into your local '' | + | Just copy and paste this into your local '' |
<code javascript> | <code javascript> | ||
- | var default_text | + | /** |
+ | * Add a placeholder text into the input field of the wiki search | ||
+ | */ | ||
+ | jQuery(function () { | ||
+ | | ||
- | function DefaultSearch_blur() | + | |
- | { | + | if ($searchinput.length |
- | | + | |
- | if (search_input !== null && | + | } |
- | | + | }); |
- | } | + | </ |
- | function DefaultSearch_focus() | ||
- | { | ||
- | var search_input = document.getElementById(' | ||
- | if (search_input !== null && search_input.value == default_text) | ||
- | search_input.value = ""; | ||
- | } | ||
- | |||
- | function CheckSearch() | ||
- | { | ||
- | var search_input = document.getElementById(' | ||
- | if (search_input !== null && search_input.value == default_text) | ||
- | search_input.value = ""; | ||
- | } | ||
- | |||
- | function installDefaultSearch() | ||
- | { | ||
- | var search_input = document.getElementById(' | ||
- | var search_form | ||
- | if(search_input !== null) { | ||
- | addEvent(search_input, | ||
- | addEvent(search_input, | ||
- | search_input.value = default_text; | ||
- | } | ||
- | if (search_form !== null) { | ||
- | addEvent(search_form, | ||
- | } | ||
- | |||
- | |||
- | } | ||
- | |||
- | addInitEvent(installDefaultSearch); | ||
- | </ | ||
===== More info ===== | ===== More info ===== | ||
Can be found in the [[: | Can be found in the [[: | ||
- |
tips/default_text_search.1289603820.txt.gz · Last modified: 2010-11-13 00:17 by 137.71.23.54