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

Detailed explanation of jQuery.now() function usage

巴扎黑
Release: 2017-07-08 11:32:29
Original
1684 people have browsed it

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() );
}
Copy after login

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时间戳
Copy after login

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!

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