我想更改搜索框中的文本值,例如說「Awesome Search」。我知道可以用Jquery完成,但我無法實現它的工作。你能幫忙嗎?我怎樣才能改變這與jquery?
請注意,這是由WordPress提供的默認設置,對於我來說,要編輯文件以將內容與行爲分開是很困難的,所以我需要Jquery覆蓋默認設置。迄今爲止提供的兩個答案似乎並沒有這樣做。
<input type="text"
onblur="if (this.value == '') {this.value = 'To search, type and hit enter';}"
onfocus="if (this.value == 'To search, type and hit enter') {this.value = '';}"
id="s"
name="s"
value="To search, type and hit enter"
class="text_input">
*當你想讓它顯示「Awesome Search」時? – 2011-06-07 02:28:33
@ Box9哎呀。抱歉。我希望文本在搜索框中可見,而訪問者不必將光標移動到搜索框中。 – mjmitche 2011-06-07 03:25:24