javascript - 内联 css 不适用于 JQM

标签 javascript jquery html css jquery-mobile

我开始使用 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/

相关文章:

javascript - 如何使用jquery获取类名?

php - mVc 世界中的 HTML 缩进

javascript - JQuery/CSS : Append div using mouse coords and position: absolute

javascript - 如何在调整大小事件中获取 html5 视频宽度?

javascript - 将元素滑出屏幕 -- 等待 --- 滑回原位

javascript - 如何显示选定的div并隐藏其他兄弟div?

javascript - 从 SignaturePad 导出不带透明背景的图像

jQuery 对话框设置 radio 检查问题

java - 从 servlet 打开 URL

javascript - 带折叠 BootStrap 的菜单