我开始使用 phonegap,所以我是新手。我将 JqueryMobile 添加到其中。一切都很好,但我如何更改文本字段的样式。 当我使用像
这样的内联 css 时<input type="text" style="width:30px;" />
这是行不通的。还有其他方法吗?
最佳答案
它不起作用,因为您不需要更改输入宽度,该元素隐藏在 jQuery Mobile 中。您需要更改其包装器 DIV,并且只能通过 javascript 完成。
工作示例:http://jsfiddle.net/Gajotres/kSAGf/
$(document).on('pagebeforeshow', '#index', function(){
$('#custom-input').parent().css('width','30px');
});
关于javascript - 内联 css 不适用于 JQM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16948966/