奇怪的Buttonset行为

时间:2013-12-26 11:16:47

标签: jquery css jquery-ui

我有:

<div id="wid_weekdays">
    <input type="checkbox" name="weekday[]" checked="true" id="weekday1">
    <label for="weekday1">MO</label>
    <input type="checkbox" name="weekday[]" checked="true" id="weekday2">
     <label for="weekday2">TU</label>
    <input type="checkbox" name="weekday[]" checked="true" id="weekday3">
     <label for="weekday3">WE</label>
    <input type="checkbox" name="weekday[]" checked="true" id="weekday4">
     <label for="weekday4">TH</label>
    <input type="checkbox" name="weekday[]" checked="true" id="weekday5">
     <label for="weekday5">FR</label>
    <input type="checkbox" name="weekday[]" checked="true" id="weekday6">
     <label for="weekday6">SA</label>
    <input type="checkbox" name="weekday[]" checked="true" id="weekday7">
     <label for="weekday7">SU</label>
</div>

$(function(){ $("#wid_weekdays").buttonset(); });

混合了大量代码,以某种方式导致:


库,样式表等:

<link rel="stylesheet" href="lib/jquery-ui/themes/ui-darkness/jquery-ui.css">
    <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="lib/fullcalendar/fullcalendar.css">
    <link rel="stylesheet" href="lib/jqGrid/css/ui.jqgrid.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="shortcut icon" href="images/favicon.png">
    <script src="lib/jquery-ui/jquery-1.9.1.js"></script>
    <script src="lib/jquery-ui/plugins/globalize.js"></script>
    <script src="lib/jquery-ui/plugins/mousewheel.js"></script>
    <script src="lib/jquery-ui/plugins/shortcut.js"></script>
    <script src="lib/bootstrap/js/bootstrap.js"></script>
    <script src="lib/jquery-ui/ui/jquery-ui.js"></script>
    <script src="lib/fullcalendar/fullcalendar.js"></script>
    <script src="lib/jqGrid/js/jquery.jqGrid.min.js"></script>
    <script src="lib/jqGrid/js/i18n/grid.locale-en.js"></script>
    <script src="js/nav.js"></script>

HTML: http://pastebin.com/kNSDi8PW
CSS:http://pastebin.com/dF2WLdDP
如果我将此代码粘贴到一个没有其他内容的空文件中,它就可以正常工作 是什么导致这个?我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

很可能会执行换行符,display: block;或类似的内容。请发布您的CSS和/或创建一个jsfiddle以便我们确定。

关于你的意见:

#wid_weekdays label, #wid_weekdays input {
    display: inline; }

<input type="checkbox" name="weekday[]" checked="true" id="weekday7">
<label for="weekday7">SU</label>

所有#wid_weekdays子项的标签和输入现在都会显示为内联。

答案 1 :(得分:0)

#wid_weekdays label, #wid_weekdays input 
{
    display: inline-block;
}

解决了问题!