By “line break” I do not mean the <br /> tag. Rather what I mean is the actual line break itself in the HTML like below:
<html>
<body> <--This is on a new line
I have a set of div’s that are display:inline-block and depending on whether or not the following <div> is on a new line or the same line it displays slightly differently. Generating these div’s in PHP requires that these are on new lines. The catch is that I need to generate these same div’s in jQuery by using a $(this).clone().appendTo(element) and I don’t know how to add the line break using jQuery.
So is there some kind of trick that will append these div’s on new lines or some kind of css property that would display it the same either way?
This is what my html looks like using PHP:
<div>
<label>Input label</label>
<input type="text" />
</div>
<div>
<label>Input label</label>
<input type="text" />
</div>
This is what it’s like using jQuery:
<div>
<label>Input label</label>
<input type="text" />
</div><div>
<label>Input label</label>
<input type="text" />
</div>
In the string you are using for your html, use a
\n.