he
can someone kindly tell me how to let content break line in label component?
the content will get from db in string form.
You mean you want to add a break in between lines?
Yes,so thanks!
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"
//Set HTML to labelName component.
Apperyio("labelName").html("html");
/code/pre
Regards.
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
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.
this way is work!
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?
You can replace your line breaks with the html code<br>/code this way
code
str = str.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
You got to remove the double quotes
It should be Apperyio("labelName").html(html);
so sorry
when I use the load event to set the js .
the page will no open!