user2408952
user2408952

Reputation: 2041

New line in a Paragraph not working

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.

Upvotes: 1

Views: 2161

Answers (2)

sbking
sbking

Reputation: 7680

function popupBasicPris() {
  $("#prisMatchPopup").html(
    "Du har indtastet: <br /> Pris: " + $("#textinputpris").val() + "<br /> Vil du sende?"
  );
}

Upvotes: 0

Jonathan
Jonathan

Reputation: 1833

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

Reference .html()

Upvotes: 6

Related Questions