在我的 HTML 页面中,我想根据计数显示特定数量的按钮。所以我曾经动态地显示这些按钮。 Fot 我已经写了
var html = "<a href='#' data-role='button' data-theme='b' data-inline='true'>Pay</a>";
$("#DivId").append(html);
但是样式没有应用到按钮。当我尝试直接在 Div 标签中编写以下代码时,它工作正常
<a href='#' data-role='button' data-theme='b' data-inline='true'>Pay</a>
有什么帮助吗?
最佳答案
您必须允许 JQueryMobile 更新新添加的 DOM 元素。
参见 http://jquerymobiledictionary.pl/faq.html
var html = "<a href='#' data-role='button' data-theme='b' data-inline='true'>Pay</a>";
$("#DivId").append(html).trigger('create');
关于jquery - 在 JQuery 中使用 CSS 编写 Html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11196616/