输入框获取焦点 显示/隐藏 value
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'}); } } }); })
高否?富否?帅否?
否?
滚去学习!

浙公网安备 33010602011771号