JQuery表单用例(一)

阅读更多

      有时侯告诉用户应该怎么做很重要,尤其是当填写一个复杂的表格的时候.此代码使用title属性在一个单独的DOM元素里显示帮助。(翻译的生硬了...)

     



	
		
		
			

	
foo bar

Focus on one of the form elements above.

 

jquery.js这个从那啥网上下就行...

jquery.autohelp.js 代码

$.fn.autohelp = function(t, o) {
	t = $(t); o = o || {};
	var h;
	this.focus(function() { h = t.html(); (o.hide ? t.show() : t).html(this.title); })
	    .blur(function() { (o.hide ? t.hide() : t).html(h); });
	return this;
}

 

你可能感兴趣的:(jQuery,JavaScript,HTML)