如何在jQuery Mobile按钮中手动换行? [英] How do I do a manual line break in an jQuery Mobile button?

查看:55
本文介绍了如何在jQuery Mobile按钮中手动换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个包含多行的按钮.我可以添加white-space:normal,但是不允许手动换行.我已经尝试过使用<br>&#x00A;,但是它们不起作用,因为jQM按钮仅是文本. 请注意,我不需要自动换行符,但是我想自己决定将换行符放在何处. 我也不想更改按钮的高度.不,我想添加额外的换行符.

I want to have a button with multiple lines. I could add white-space:normal but that does not allow manual line breaks. I have tried with <br> and &#x00A; but they don't work as a jQM button is text only. Note that I do not want automatic line-breaks, but I want to decide myself where to put them. Nor do I want to change the height of the button. No, I want to add extra linebreaks.

即我希望能够有一个
按钮 文字
喜欢
这个

代替
这样的文字

i.e. I want to be able to have a button with
Text
like
this

instead of
Text like this

有没有办法解决这个限制?

Is there a way around this limitation?

推荐答案

好的,有一种方法可以做到.由于我使用GWT,所以我可以做到

Ok, there is a way to do it. Since I use GWT I can do

JQMButton b = new JQMButton("dummy text");
b.getElement().setInnerHTML("this<br>text<br>works");

这篇关于如何在jQuery Mobile按钮中手动换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆