I've a .Net application wherein one of my pages, during initial page load, I'm setting the text of an asp label control. In my aspx page, I've a Javascript function to read the label text and show a confirmation pop-up message. The problem is, "\n" with in the label text is not introducing a line break in the JS confirmation message.
My Code Behind
lblMsg.Text = "string1" + "\n" + "string2"
Aspx Page
function PendingDeleteValidate() {
var x = document.getElementById("<%=lblMsg.ClientID%>");
if (confirm(x.innerHTML))
return true;
else
return false;
}
The JS confirmation dialog message shows:
string1\nstring2
I need to show a line break between the two strings.
Try "\r\n \r\n" after title text.
function myFunction() {
confirm("Tittle of DialogBox \r\n \r\nMessage of dialogbox. bla..bla.. bla... bla... bla..");
}
Fiddle Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With