문제

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