- swap_val = [];
- $("#s").each(function(i) {
- swap_val[i] = $(this).val();
- $(this).focusin(function() {
- if($(this).val() == swap_val[i]) {
- $(this).val("");
- }
- }).focusout(function() {
- if ($.trim($(this).val()) == "") {
- $(this).val(swap_val[i]);
- }
- });
- });
- //该片段来自于http://www.codesnippet.cn/detail/21112012545.html
来源: http://www.codesnippet.cn/detail/21112012545.html