好的,我已经对 css 进行了排序:
现在对输入框的样式(但这不起作用)有任何建议。认为我的 js 搞砸了。 html 元素:
<input name="latLng" class="latLng" id="latLng2" type="text" disabled />
JS:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('input.latLng').locationPicker({
width: "500px",
height: "20px",
backgroundColor: '#fff',
border: '1px solid #ccc',
borderRadius: 10,
padding: 10
});
});
</script>
请问我哪里出错了。
最佳答案
要设置样式,请使用 .css()
设置元素的样式并单独调用您的插件,如下所示:
jQuery(document).ready(function(){
jQuery('input.latLng').css({
width: "500px",
height: "20px",
backgroundColor: '#fff',
border: '1px solid #ccc',
borderRadius: 10,
padding: 10
}).locationPicker();
});
或者,短一点:
jQuery(function($){
$('input.latLng').css({
width: 500,
height: 20,
backgroundColor: '#fff',
border: '1px solid #ccc',
borderRadius: 10,
padding: 10
}).locationPicker();
});
关于jquery - 使用 jquery 设置输入样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4139621/