1

data-themeJavaScriptからすべてのdiv、listviews、forms、li、ulなどに値を追加するにはどうすればよいですか?
出来ますか?はいの場合、どうすればそれを行うことができますか?

次のようなものは機能しますか?

$.mobile.page.prototype.options.contentTheme= "e";
4

2 に答える 2

1
Array.prototype.forEach.call(document.getElementsByTagName("*"), function (el) {
    el.setAttribute("data-theme", "e");
});
于 2012-09-14T09:06:59.690 に答える
1

jquery-mobile が含まれている場合は、次のように動作します。

$.mobile.page.prototype.options.contentTheme= "e";
$.mobile.page.prototype.options.headerTheme= "e";
$.mobile.page.prototype.options.footerTheme= "e";

ただし、ヘッダー、コンテンツ、またはフッターの一部ではない要素を追加した場合は、すべての要素に適用する Domenic の方法に従う必要があります。

于 2012-09-14T11:51:38.093 に答える