I have a variable:
var remoteControlPage = '
<table>
<tr>
<td class="stats">sadfsadf</td>
</tr>
</table>
';
and I want to use it in a Jquery .html function like this:
$("div.devices div.devicePage").html(remoteControlPage);
The problem is the html function wont work unless the new content is in a sing line. And this is not desirable when writing html.
So I was wondering if there is anyway to convert the var remoteControlPage into a single lined variable?
Thanks
You can’t define a variable like this:
In any case, you could have a textarea which is filled by the user with the text
And then you get it:
But when you do that the text is changed to
Then, if you want to remove the line-breaks, you can do
But you don’t need that. If you say that the users will write the HTML, you can use a
<textarea>, ……a button, …
… and a output HTML viewer:
And then you just need
Demo: http://jsfiddle.net/bYsTy/6/