简体   繁体   English

内联css不适用于JQM

[英]Inline css doesn't work with JQM

I started working with phonegap so I am new with it. 我开始使用phonegap,所以我是新手。 I included JqueryMobile to it. 我把JqueryMobile包含在内。 It all works nicely but how do I change the style of for example a text field. 这一切都很好,但我如何更改文本字段的样式。 When I use inline css like 当我使用内联css时

<input type="text" style="width:30px;" /> 

It doesn't work. 它不起作用。 Is there another way to do this? 还有另一种方法吗?

It is not working because you dont need to change input width, that element is hidden in jQuery Mobile. 它不起作用,因为你不需要改变输入宽度,该元素隐藏在jQuery Mobile中。 You need to change its wrapper DIV and it can be only done through javascript. 您需要更改其包装器DIV,它只能通过javascript完成。

Working example: http://jsfiddle.net/Gajotres/kSAGf/ 工作示例: http//jsfiddle.net/Gajotres/kSAGf/

$(document).on('pagebeforeshow', '#index', function(){ 
    $('#custom-input').parent().css('width','30px');    
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM