2012-12-19 178 views
1

如何将变量值添加到新变量中? 我修改新闻滑块和我想插入“日期”为副标题jquery:将变量添加到变量中

我已经试过:

(function($){ 
     $.fn.accessNews = function(settings){ 

       $now = new Date(); 
       var defaults = { 
         // title for the display 
         title: "news:", 
         // subtitle for the display 
         subtitle: "$now", 

回答

10

引文结束吧:

{ 
    // ... 

    subtitle: $now, 
} 
+0

它打破了代码'的ReferenceError:$ formatDate没有定义 [打破这个错误] \t 字幕:$ formatDate,' – teslasimus

+0

@teslasimus如果你需要一个字符串值,将您'Date'对象'的toString()'。 – VisioN