jQuery继承extend用法

js代码

//直接基于jQuery的扩展,判断是否为空
$.isBlank = function(obj){
		return(typeof(obj)=='undefined'||obj==''||obj==null);
	}
//直接基于jQuery的扩展,去除html标签,保留内容
	$.htmlContent = function(tag){
	   var reTag = /<(?:.|\s)*?>/g;  
       return  tag.replace(reTag,"");  
	}
//直接基于jQuery的扩展(方式二)
$.xy = { 
sayhello:function(){return "hello";},
saybaybay:function(){return "baybay";}
}; 
//jQuery类级别的扩展
$.extend({ 
add:function(a,b){return a+b;},
diff:function(a,b){return a-b} 
}); 
//jQuery对象级别的扩展
$.fn.extend({ 
	getvalue:function(){ 
	return this.val();
		}
	}); 
html代码

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



  
    
    
    My JSP 'index.jsp' starting page
	
	
	    
	
	
	
	
  
  
  
   
  
  
    
    
    
  

输出

jQuery继承extend用法_第1张图片


你可能感兴趣的:(jquery)