jQuery继承extend用法详解
(编辑:jimmy 日期: 2024/11/19 浏览:3 次 )
本文实例为大家jQuery继承extend用法,供大家参考,具体内容如下
js代码
//直接基于jQuery的扩展,判断是否为空 $.isBlank = function(obj){ return(typeof(obj)=='undefined'||obj==''||obj==null); } //直接基于jQuery的扩展,去除html标签,保留内容 $.htmlContent = function(tag){ var 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+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.7.js">输出
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
下一篇:mvc 、bootstrap 结合分布式图简单实现分页