Grow your CSS skills. Land your dream job.

JQuery Variables

  • # May 27, 2010 at 10:23 am

    Hi all,

    I’m struggling with something that is probably very simple.

    In php if I have a variable I can add to it easily like

    Code:
    $say = “hello”;
    $say.=” world”;

    And now $say will read "hello world"

    How on earth can I do that in JQuery?

    Thanks all.

    # May 27, 2010 at 10:30 am

    Ok so I found it. I looked for ages and then came accross the answer.

    Code:
    var say = “Hello”;

    say =+ ” World”;

    I hope this helps someone else.

    Rob
    # May 27, 2010 at 10:35 am

    haha I just posted that :D

    # May 27, 2010 at 10:55 am

    I can’t believe I was so daft. Nevermind.

    Thanks anyway… :D

    Rob
    # May 27, 2010 at 1:00 pm

    well if I use PHP too much I can never remember what the concatenation is in Javascript lol

    # May 28, 2010 at 9:22 pm

    For the record, jQuery has nothing to do with that, it’s just JavaScript, and the syntax is:

    Code:
    var someString = “Hello, “;
    someString += “World!”;
    # May 29, 2010 at 4:26 am

    Thanks for the Chris. When I asked I didn’t know if JQuery did it a specific way.
    I’m not expert with JavaScript or JQuery to be honest.

    Thanks for the help in any case.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".