防止jquery mobile设置样式元素 [英] prevent jquery mobile from styling element

查看:111
本文介绍了防止jquery mobile设置样式元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要隐藏在页面上的复选框.我显而易见的第一次尝试是:

I've got a checkbox that I want hidden on the page. My obvious first attempt was the following:

<input type='checkbox' style='display:none' />

但是,我注意到jquery mobile自动将复选框包装在如下所示的div中:

However, I noticed jquery mobile automagically wraps the checkbox in a div that looks like this:

<div class='ui-checkbox'>
  <input type='checkbox' style='display:none;' />
</div>

我认为存在某种data-元素可以防止这种额外的样式,但是在文档或其他地方找不到它.覆盖css中的.ui-checkbox来隐藏它也很容易,但是更喜欢使用jquery移动标准方法.这样的东西存在吗?

I would assume that there's some kind of data- element that would prevent this additional styling, but haven't found it in the docs or elsewhere. It's easy enough to override the .ui-checkbox in css to hide it as well, but would prefer a more jquery mobile-standard approach. Does such a thing exist?

推荐答案

阻止样式设置的属性是data-role="none"

The attribute that prevents styling is data-role="none"

<input type='checkbox' style='display:none' data-role="none" />

请参见 jQuery文档:防止表单元素的自动初始化"

See the Jquery doc: "Preventing auto-initialization of form elements"

这篇关于防止jquery mobile设置样式元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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