Home > Web Front-end > JS Tutorial > body text

Summary of js and jquery knowledge points

小云云
Release: 2018-03-22 17:35:32
Original
1300 people have browsed it

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("—");        }
   });
Copy after login
$.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);//给每一条数据排序
Copy after login

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template