Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hy frens, how can i get this concat values in new line . my code looks like this

C#
if (InitialValue == "No Product Selected") {
                   $("[id*=lblShopProdID]").text(ProductDetails);
                   alert("Product Detailed:--" + ProductDetails + "--added successfully to cart");
               }
               else
               {
                   var newInitialValue = $("[id*=lblShopProdID]").text();
                   $("[id*=lblShopProdID]").text(newInitialValue + ProductDetails);
                   alert("Product Detailed: " + ProductDetails + " added successfully to cart");

               }



lblShopProdID needs to show concatenated values but it is showing in single line no line break i need to have line break between new initialvalue and productdetails


please help thanks
Posted

First of all, new line character depends on the OS: http://en.wikipedia.org/wiki/newline.

The code is unrelated to jQuery, but only related to JavaScript. It could be:
JavaScript
a = 13; // object of any types can be concatenated with strings
b = "some text";
c = a + "\n" + b; //Unix style
d = a + "\r\n" + b; //DOS/Windows style;
//...

Many modern components accept any consistent combinations of these characters, so it depends on how you use those strings.

Are you sure you really need it? More usually, JavaScript code produces strings for HTML rendering, which requires the </br> element.

—SA
 
Share this answer
 
 
Share this answer
 
v2

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