function hasPlaceholderSupport() { var input = document.createElement('input'); return ('placeholder' in input); } var UsernameBox = $('userName') message = UsernameBox.get('placeholder'); UsernameBox.addEvents({ focus: function() { if(UsernameBox.value == message) {searchBox.value = '';} }, blur : function() { if (UsernameBox.value == '') { searchBox.value = message } } });