Home  >  Article  >  Web Front-end  >  Summary of js and jquery knowledge points

Summary of js and jquery knowledge points

小云云
小云云Original
2018-03-22 17:35:321297browse

This article mainly shares with you a summary of js and jquery knowledge points, hoping to help everyone.

return statement:

Generally three usages: 1.return true======》Return the correct result of the current function.

2.Rturn false ====== "Back to the error processing results of the current function; terminate the processing, prevent the form of the form, and the default behavior has been bubbling.

            3.return =========》Return the current results to the page.

Summary: =====================》return true is equivalent to the executor, and return false is equivalent to the terminator. return is to return the current result.

Simple summary of regular rules:

var regExp = /(.*).(bak)$/;==========》Match suffix files in bak format

var reg = /^[\u4E00-\u9FA5]{2,4}$/;=====》matches two to four Chinese characters, generally used for name validation.

var tel = /^(\(\d{3,4}\)|\d{3,4}-)?\d{7,8}(-\d{1,4} )?$/;===》The validity of the phone number

var phone = /^1[34578]\d{9}$/;=====》The validity of the mobile phone number is 13 |14|15|17|18|The mobile phone number used at the beginning.

The data requested by the form, if the requested data is empty, use _ to complete it.

var $audit = $("#example5").find("tr").find("td");
    $.each($audit, function (k, v) {           
      //获取tr下所有的td的文本值        
        var audit = $audit.eq(k).text();       
         if (audit === null || audit === "") 
         {                $audit.eq(k).text("—");        }
   });
$.each(result.OCSPCRLs, function (i, v) 
{            //var ocsp = new Object();           
// ocsp.ocspIP = v.OCSPUrl;          
  ocsp.num = parseInt(i) + parseInt(1);//给每一条数据排序        
      //ocspList.push(ocsp);
   });
 ocsp.num = parseInt(i) + parseInt(1);//给每一条数据排序

If the custom attributes of general tags are set with js, they can be set through dataset. For example,

document.getElementById('dt').dataset.news= '321';

Then add an attribute such as e5d740b91980221d6def236cc3d25f4e54bdf357c58b8a65c66d7c19c8e4d114

Related recommendations:

What is the difference between JS and JQUERY

The above is the detailed content of Summary of js and jquery knowledge points. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Introduction to BOM of jsNext article:Introduction to BOM of js