Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

content break line

he
can someone kindly tell me how to let content break line in label component?
the content will get from db in string form.
Image

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

content break line

You mean you want to add a break in between lines?

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

content break line

Yes,so thanks!

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

content break line

I hope it can be like that below.thanks you so much!
Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

content break line

HI Spark,

Yes you can use HTML code to make markup for label component.
But you can set this HTML only with JS code.

Here is an example:

precode

//this is your HTML code
var html = "1st line<br/>2nd line<br/>3rd line&quot

&#47;&#47;Set HTML to labelName component&#46;
Apperyio("labelName")&#46;html("html");

/code/pre

Regards.

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

content break line

Yurii
thanks for your reply.
so I just post the code above to the db in string form?
and get that form db to label component?

or I need to use "load event" to set the label component to html?
thanks

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

content break line

Yurii
I try to way to test .please guide me how to fix that.
way one:
use html component in page,and key in content in db like below.
Image
this way is work!
Image

way two:
use label component in page,and key in content is db like below.
var html = "1st line
2nd line
3rd line";
and set the load event with run js.
Apperyio("labelName").html("html");
this way is no working .
did I did any thing wrong?

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

content break line

You can replace your line breaks with the html code<br>/code this way

code
str = str&#46;replace(/(?:\r\n|\r|\n)/g, '<br />');
/code

So if your existing text has line breaks, then JS will convert them into HTML line breaks

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

content break line

You got to remove the double quotes
It should be Apperyio("labelName").html(html);

Spark Chao
Posts: 0
Joined: Sat Jan 17, 2015 6:25 am

content break line

so sorry
when I use the load event to set the js .
the page will no open!

Return to “Issues”