Click here to Skip to main content
15,877,967 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
im using jquery with html page.i post a paragraph in rich textbox. i convert to removed

tag. my sample output is below

output is:

C#
A2Z Infra Engineering has secured the contract vide the letter of award from for the construction of the sub-station on turnkey basis (Survey, design, civil work, installation, testing & commissioning).A2Z Infra Engineering has secured the contract vide the letter of award from for the construction of the sub-station on turnkey basis (Survey, design, civil work, installation, testing & commissioning).



i want to Output is:
C#
A2Z Infra Engineering has secured the contract vide the letter of award from for the construction of the sub-station on turnkey basis (Survey, design, civil work, installation, testing & commissioning).


C#
A2Z Infra Engineering has secured the contract vide the letter of award from for the construction of the sub-station on turnkey basis (Survey, design, civil work, installation, testing & commissioning).


i give a record also space under paragraph but output get fully joined. please help

What I have tried:

<script type="text/javascript">
$(document).ready(function () {
debugger
var newsid = GetParameterValues('newsid');
var newsid = getCookie();
//deleteAllCookies();
var url = "http://localhost:24844/NewsRestService.svc/NewsById/" + newsid;
var out = "";
$.getJSON(url, function (data) {
if (data.NewsByIdResult.length > 0) {
out += '
'
+ '

' + data.NewsByIdResult[0].DomexVersion + '

';
}

document.getElementById("newsget").innerHTML = out;
});
});
</script>

Posted
Updated 14-Jul-16 2:35am
v3
Comments
F-ES Sitecore 14-Jul-16 7:57am    
On the "out" variable replace "." with ".</br></br>". Google "javascript string replace" for examples.
Thiyagu Arockiasamy 14-Jul-16 8:24am    
dear sir not working for me sir . please help
Thiyagu Arockiasamy 14-Jul-16 8:27am    
its only working for first paragraph sir . separated in lot of paragraphs sir. help me sir
F-ES Sitecore 14-Jul-16 9:06am    
javascript replace only works for the first instance, not all like .net replace. The idea of splitting and joining in solution 1 is probably the best way to go.
Thiyagu Arockiasamy 15-Jul-16 3:23am    
dear sir i changed my insert method its work fine sir. Thanks a lot

1 solution

try this

JavaScript
document.getElementById('newsget').innerHTML = out.split('.').join('.<br />');
 
Share this answer
 
v2
Comments
Thiyagu Arockiasamy 14-Jul-16 8:41am    
dear sir after '.' is not a correct way for me sir. if i give Rs.120 Crore. It will take two spaces of two paragraph sir. please help
Thiyagu Arockiasamy 14-Jul-16 8:45am    
<p></p> tag is applicable for me sir after close </p> tag next paragraph start
Karthik_Mahalingam 14-Jul-16 9:03am    
so how do you want to split the paragraph?
Thiyagu Arockiasamy 15-Jul-16 3:23am    
dear sir i changed my insert method its work fine sir. Thanks a lot
Karthik_Mahalingam 15-Jul-16 4:14am    
ok fine.. close this post.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900