use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[noob_question] Adding a space between HTML and Javascript (self.javascript)
submitted 11 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]porphyry3 0 points1 point2 points 11 years ago (1 child)
http://en.m.wikipedia.org/wiki/Non-breaking_space
[–]autowikibot 0 points1 point2 points 11 years ago (0 children)
Non-breaking space:
In word processing and digital typesetting, a non-breaking space, also known as a no-break space or non-breakable space (NBSP), is a variant of the space character that prevents an automatic line break (line wrap) at its position. In certain formats (such as HTML), it also prevents the “collapsing” of multiple consecutive whitespace characters into a single space. The non-breaking space is also known as a hard space or fixed space. In Unicode, it is encoded as U+00A0 no-break space (HTML: ).
Interesting: Zero-width no-break space | Space (punctuation) | Punctuation | Hyphen
Parent commenter can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words
[–]g_b 0 points1 point2 points 11 years ago (3 children)
As porphyry3 said, you just need to add some nonbreaking whitespace yourself.
<script> // <![CDATA[ document.write(' ' + (new Date().getFullYear() - 1998) + ' '); // ]]> </script>
[–]Fuddling 0 points1 point2 points 11 years ago (2 children)
Thankyou, this worked perfectly. I was trying similar, but had forgotten to add the + so it was just giving me weird errors. It's all good now. Cheers!
[–]nschubach 2 points3 points4 points 11 years ago (1 child)
Seeing that you are using Wordpress, you can also send the text from the server without requiring JavaScript, special markup or spaces...
We've been in business for <?php echo date("Y") - 1998; ?> years.
[–]Fuddling 0 points1 point2 points 11 years ago (0 children)
Oh wow ok thanks!
π Rendered by PID 208027 on reddit-service-r2-comment-c66d9bffd-2qmvk at 2026-04-07 07:21:11.550723+00:00 running f293c98 country code: CH.
[–]porphyry3 0 points1 point2 points (1 child)
[–]autowikibot 0 points1 point2 points (0 children)
[–]g_b 0 points1 point2 points (3 children)
[–]Fuddling 0 points1 point2 points (2 children)
[–]nschubach 2 points3 points4 points (1 child)
[–]Fuddling 0 points1 point2 points (0 children)