$.fn.extend extension is a jquery object function, $.extend extension is a jquery global function
<! DOCTYPE Html>"UTF-8"><title>insert title Here</title><script type="Text/javascript"Src=".. /.. /resources/js/jquery-2.0.0.js"></script><script type="Text/javascript"Src=".. /.. /resources/customjs/regexp.js"></script>" Time"Type="Button"Name=" Time"Value="Enter Date"/><br/><input id="AddData"Name=""Type="Button"Value="Add Data"/></body><script type="Text/javascript">$("#time"). Click (function () {varInputdate = Prompt ("Please enter the date:"); varFlag =validate.validatedate (inputdate); Console.log (flag);}); $("#addData"). Click (function () {//$.fn.extend jquery Object Functions$( This). inputdatatohtml (); });//jquery Global Functions$.inputdataastitle ();</script>Regexp.js
varValidate = { //Verify the date formatted as YYYY-MM-DDvalidatedate:function (inputdate) {varR = Inputdate.match (/^ (\d{1,4}) (-|\/) (\d{1,2})\2(\d{1,2})$/); if(r==NULL) return false; varD=NewDate (r[1], r[3]-1, r[4]); return(D.getfullyear () ==r[1]&& (D.getmonth () +1) ==r[3]&&d.getdate () ==r[4]); }}$.fn.extend ({inputdatatohtml:function () {vardata = prompt ("Please enter data:"); if($("#list"). length==0&&$ ("#list ol"). length==0){ $( This). After ("<div id= ' list ' ></div>"); $("#list"). Append ("<ol></ol>"); } $("#list ol"). Append ("<li>"+data+"</li>"); }}) $.extend ({inputdataastitle:function () {vardata = prompt ("Please enter a title:"); $("Body"). Append (""+data+"</font>"); }});
JS for extend and fn.extend use