That's my input field. I want to make value of it empty when I click it. How can I do this by using prototype framework of Javascript ?
<input name="ctl0$txtSearch" type="text" value="Quick Search" id="ctl0_txtSearch" class="MainSearchBar" />
Actually I am using PRADO. So the html tag to create input is
<com:TTextBox Id="txtSearch" Text="Quick Search" CssClass="MainSearchBar" />
And it has no onclick attr to handle Javascript.
onClick doesn't respond to keyboard events such as being 'tabbed' into. It would be more advisable to use onFocus for this. And to complement the operation also use onBlur.
<com:TTextBox Id="txtSearch" Text="Quick Search" CssClass="MainSearchBar"
Attributes.onfocus="if (this.value == this.defaultValue) this.value = '';"
Attributes.onblur="if (this.value == '') this.value = this.defaultValue;"
/>