跳到主文
部落格全站分類:數位生活
input原本顯示"說明文字",
當input取得focus後,將"說明文字"清空,
當input離開focus後,如果沒有輸入資料的話,將input改回"說明文字"。
範列如下:
HTML Code:
<input type="text" value="DESC" />
Code:
$(document).ready(function() { $('input').focus(function() { var value=$(this).val(); $(this).val(""); }); $('input').blur(function() { if($(this).val()=="") { $(this).val(value); } }); });
白羽‧獨舞
carllee413 發表在 痞客邦 留言(0) 人氣()
留言列表