473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Replace Line breaks

Hi does anyone knows, How to remove line breaks from a string using
javascript.
I have a string like:
<div <div class="style1">Yates<br>-47.13

but somehow the javascript is displaying string "-47.13"
as
-
47.13
It is treating a "-" sign as a line break.
Any comments.
Sep 25 '08 #1
4 3563
On 2008-09-25 21:19, Sunny wrote:
but somehow the javascript is displaying string "-47.13"
as
-
47.13
It is treating a "-" sign as a line break.
That's not possible. Something else is causing line breaks here. Maybe
one of your <div>s is too narrow.

- Conrad
Sep 25 '08 #2
On Sep 25, 8:19*pm, Sunny <sunnyluth...@gmail.comwrote:
Hi does anyone knows, How to remove line breaks from a string using
javascript.
I have a string like:
<div*<div class="style1">Yates<br>-47.13

but somehow the javascript is displaying string "-47.13"
as
-
47.13
It is treating a "-" sign as a line break.
Any comments.
Wrapping the entire number -47.13 as <nobr>-47.13</nobrcould fix it,
at least in IE7.

--
(c) John Stockton, near London, UK. Posting with Google.
Mail: J.R.""""""""@physics.org or (better) via Home Page at
Web: <URL:http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ....|
Sep 25 '08 #3
On Sep 25, 6:36 pm, Dr J R Stockton <J.R.Stock...@physics.orgwrote:
On Sep 25, 8:19 pm, Sunny <sunnyluth...@gmail.comwrote:
Hi does anyone knows, How to remove line breaks from a string using
javascript.
I have a string like:
<div <div class="style1">Yates<br>-47.13
but somehow the javascript is displaying string "-47.13"
as
-
47.13
It is treating a "-" sign as a line break.
Any comments.

Wrapping the entire number -47.13 as <nobr>-47.13</nobrcould fix it,
at least in IE7.

--
(c) John Stockton, near London, UK. Posting with Google.
Mail: J.R.""""""""@physics.org or (better) via Home Page at
Web: <URL:http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ....|
Hi Thanks, It fixed the problem.
Sep 26 '08 #4
On 2008-09-26 15:16, Sunny wrote:
>Wrapping the entire number -47.13 as <nobr>-47.13</nobrcould fix it,
at least in IE7.
....
Hi Thanks, It fixed the problem.
<nobris not (and never was) part of the HTML specification. Even if it
had been, it would be deprecated by now, because display formatting is
the job of CSS. A correct and portable way to prevent line breaks would
be something like this:

<style type="text/css">
..nobr { white-space: nowrap; }
</style>
....
<span class="nobr">-47.13</span>
- Conrad
Sep 26 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: windandwaves | last post by:
Hi Folk I am getting some data from an html form (textarea). I am having trouble with replacing line breaks in the data with spaces. here is my line: trim(stripslashes(str_replace("\n",...
8
by: middletree | last post by:
What's wrong with this code? strLongDesc = Replace(Replace(Replace(Replace(Trim(Request.Form("LongDesc")),"'","''"),vbC rLf,"<br>"),"<",&lt;),"<",&gt;) Background: This field is a textarea, and I...
23
by: SeaPlusPlus | last post by:
I want to convert large files of prose to xhtml and so I need a way to remove unwanted line wraps. So, I'm looking for a freebee editor that has the capability of searching for a single "carriage...
15
by: tshad | last post by:
How do I go about this? I used to know this, but can't find VB.net replace that does this. Something like string.replace("<br>",NL) Thanks,
1
by: David | last post by:
Hello, Quick question. If I have a whole list of text, (Technical Specifications), I understand that I can replace keystrokes with line breaks etc. What if my listing needs to like something...
5
by: joelbyrd | last post by:
Didn't know exactly where to post this, but: How do I get line breaks in a textarea? I'm pulling text from a database, and this text definately has line breaks in it, because I replaced all the...
1
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am replacing tags with db info. My problem is I some of the addresses do NOT have an address1. end up with a blank line. I want to get rid of that line I am using the following code to replace...
3
by: MB | last post by:
I need to replace all occurances of a certain character located between two tags. I have included an example of what i have come up with so far, but it doesn't work they way I want it to: str =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.