First let me starte that I've been psending the last 2 hours searching the web and trying solutions, nothing worked. I've been trying to make a new line in a Paragraph, but do'sent work. I'm using Jquery mobile and editing a paragraph with $('.selector').text(); from a javascript.

I got the follow code:

function popupBasicPris() {
    $('#prisMatchPopup').text("Du har indtastet: <br />"+ 
    "Pris: " + document.getElementById("textinputpris").value.toString() +
    "<br /> Vil du sende?");
    }

The code is run from a button click. My problem is that it just writes
instead of making a new line in the shown text.

有帮助吗?

解决方案

Change .text to .html, as you are including html elements within your output.

Reference .html()

其他提示

function popupBasicPris() {
  $("#prisMatchPopup").html(
    "Du har indtastet: <br /> Pris: " + $("#textinputpris").val() + "<br /> Vil du sende?"
  );
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top