1

How can i add variable value into a new variable? I'm modifying a news slider and i would like to insert "date" into subtitle

what i've tried:

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

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

1 Answer 1

10

Unquote it:

{
    // ...

    subtitle: $now,
}
Sign up to request clarification or add additional context in comments.

2 Comments

it breaks the code ReferenceError: $formatDate is not defined [Break On This Error] subtitle: $formatDate,
@teslasimus If you need a string value, convert your Date object toString().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.