HTML:
<input type="text" class="hint" id="hint" value="粘贴淘宝、天猫、聚划算的宝贝地址,如:Http://item.taobao.com..." name="q">
JS:
$(function() { var inputEl = $('#hint'), defVal = inputEl.val(); inputEl.bind({ focus: function() { var _this = $(this); if (_this.val() == defVal) { _this.val('').css({'color':'black'}); } }, blur: function() { var _this = $(this); if (_this.val() == '') { _this.val(defVal).css({'color':'#999999'}); } } }); })