Multiline in JavaScript

Posted By Venu Thomas

Whenever you try to write a script in Javascript that requires a string of multiple lines get an error code that is poorly trained. That is a problem for these scripts to generate HTML content, because by having a clear line and we lose we do not see exactly what you’re painting.

$('#ID').append(
   '<div id="wcDIV"> \
      <p>Welcome to WiseCodes.Com!</p> \
    </div>'
);

var strWelcome = 'Welcome \
to WiseCodes.Com!'

The key is used (\) to indicate the line, that mysteriously causes the browser detects that it is a single line, making the job of uniting us.
A curiosity of this language that helps us to make things easier and above all clear.

Happy Programming !!! ;-)

Tags: ,

  •  
  • Share with others:

    Thanks for visiting us! If you enjoyed these icons please feel free to share them! Or if you want to know what's going on with WiseCodes.com, follow us!

    3 Responses to “Multiline in JavaScript”

    1. I tried this technique a few years ago, but it didn’t work in some browsers. Perhaps things are better nowadays. Thanks for the tip!

    2. Anon your flag on August 7th, 2009 at 11:15 PM
    3. Searching for this for some time now – i guess luck is more advanced than search engines :)

    4. fastest way get my spouse back your flag on June 13th, 2010 at 3:47 AM
    5. That was a fairly useful insight for me personally

    6. Jeramy Prose your flag on August 27th, 2010 at 11:18 AM

    Leave a Reply

    Anti-Spam Protection by WP-SpamFree

    Locations of visitors to this page eXTReMe Tracker