jquery - 在 JQuery 中使用 CSS 编写 Html

标签 jquery html css jquery-mobile

在我的 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/

相关文章:

jquery - 在 Transit.js 转换期间内联显示隐藏的 DIVS?

javascript - 搜索引擎优化和显示 : none

html - 在居中文本旁边显示 div

Jquery 淡入淡出鼠标悬停不工作

html - 如何使样式颜色全局化?

jquery - 当前屏幕位置中心的绝对位置

php - Ajax "parsererror", "No conversion from text to application/json"

javascript - HTML/CSS/Javascript 类似命令行的界面

jquery - 使用 jQuery 设置 CSS3 渐变属性?

html - 为什么会溢出:hidden not working in chrome when parent div has a column-count