在Jquery Mobile的文本框中以编程方式设置数据主题 [英] Set data-theme programatically on textbox in Jquery Mobile

查看:92
本文介绍了在Jquery Mobile的文本框中以编程方式设置数据主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Jquery mobile中设置文本框的数据主题"?

Is there a way to set the "data-theme" of a textbox in Jquery mobile?

$("#txtEmail").attr("data-theme", "b");

...不起作用.

我喜欢用它来在表单验证中显示无效的表单项.

I like to use this to to display invalid form items in form validation.

推荐答案

更改主题后,您必须手动删除较早的主题类并添加新的主题类.

You have to manually remove the earlier theme class and add the new theme class after changing the theme.

$("#txtEmail").removeClass("ui-body-c").addClass("ui-body-b");

此处的演示- http://jsfiddle.net/vppvG/

这篇关于在Jquery Mobile的文本框中以编程方式设置数据主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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