html:
$("p").log().css("color","red")
jQuery:
$.fn.extend({
log: function() {
var date = new Date()
var year = date.getFullYear()
var month = date.getMonth() + 1 //月
var data = date.getDate() //日
var hours = date.getHours()
var min = date.getMinutes()
var seconds = date.getSeconds()
var day = date.getDay()
var time = year + "-" +month+ "-" + data + " " + hours + ":" + min + ":" +seconds+ " "
this.text(time)
return this
}
})