jquery inherits extend usage detailed _jquery

Source: Internet
Author: User
Tags diff return tag

This article examples for everyone to inherit extend usage, for your reference, the specific contents are as follows

JS Code

Directly based on the jquery extension, determine if null 
$.isblank = function (obj) {return 
  (typeof (obj) = ' Undefined ' | | obj== ' ' | | obj==null); 
 } 
Directly based on jquery extensions, remove HTML tags, retain content 
 $.htmlcontent = function (tag) { 
  var retag =/< (?:. | \s) *?>/g; 
  Return Tag.replace (Retag, ""); 
 } 
Direct based on jquery extension (Mode II) 
$.xy = { 
sayhello:function () {return ' Hello ';}, 
saybaybay:function () {return " Baybay ";} 
}; 
jquery class-level extension 
$.extend ({ 
add:function (a,b) {return a+b;}, 
diff:function (a,b) {return a-b} 
}); 
jquery Object-level extension 
$.fn.extend ({ 
 getvalue:function () {return 
 this.val (); 
  } 
 }); 

HTML code

<%@ 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" >  

Output

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.