Home  >  Article  >  Web Front-end  >  Detailed explanation of jQuery.now() function usage

Detailed explanation of jQuery.now() function usage

巴扎黑
巴扎黑Original
2017-07-08 11:32:291445browse

jQuery.now() function is used to return the number of milliseconds that have elapsed since midnight on January 1, 1970.

The function of this function is similar to new Date().getTime();

This function belongs to the global jQuery object.

Syntax

jQuery 1.4.3 New The static function.

jQuery.now( )

Return value

jQuery.now()The return value of the function is Number type and returns the current time The number of milliseconds since midnight on January 1, 1970.

Example & Description

The source code part of the jQuery.now() function is as follows:

now: function() {
    return +( new Date() );
}

The following jQuery sample code is used to demonstrate the specific usage of the jQuery.now() function :

//在当前页面内追加换行标签和指定的HTML内容
function w( html ){
    document.body.innerHTML += "<br/>" + html;
}
w( $.now() ); // 返回当前时间的Unix时间戳

The above is the detailed content of Detailed explanation of jQuery.now() function usage. 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