I\'m allowing a user to use either one of two textboxes to search a database - one is an ID field, and one is a freetext field. I\'m using ASP.NET with C# btw.
Anyway, a
[Demo]
var tbox1 = document.getElementById('tbox1'); var tbox2 = document.getElementById('tbox2'); tbox1.onfocus = function() { tbox2.value = ""; }; tbox2.onfocus = function() { tbox1.value = ""; };