我的「標籤」是輸入裏面,所以我想清空現場,當用戶點擊,如果其空「標籤」又回來了標籤使用jQuery
$('#name').focus(function() {
if ($(this).val()=="Your name") { $(this).val(""); }
}).blur(function() {
if ($(this).val()=="") { $(this).val("Your name") }
});
,這將是完成了3個或更多的領域,還有更好的選擇?無需使用插件,只需jQuery的
您還需要考慮,如果他們離開該領域的空白,並提交形式會發生什麼。 – 2011-03-03 19:33:49
其ajax答覆,我做php驗證只在這種情況下 – braindamage 2011-03-03 19:38:30
http://stackoverflow.com/questions/5120257/what-is-the-best-html5-placeholder-like-jquery-plugin-out-there/5120428 #5120428 – McHerbie 2011-03-03 19:47:27