Search code examples
javascriptinputonclickonbluronfocus

IE onFocus not working when landing on page


I have read a few threads on this using JS. Is there a way with or with using JS to get onFocus to work in IE when the user lands on the page?

If you click on the search box and off again, the search site... appears. It works fine in all other browsers. Thank you.


Solution

  • add value attribute to the search input field

    <input value="search site..." class="searchBox" id="q" onfocus="this.value = this.value=='search site...'?'':this.value;" onblur="this.value = this.value==''?'search site...':this.value;" type="text" size="70"/>