表单元素不在同一行

时间:2013-07-04 02:16:52

标签: jquery forms mobile switch-statement jsfiddle

使用jQuery mobile,我试图将一个开关和一个按钮放在同一行,但它不起作用,两个元素都在不同的行中:

执行命令 http://jsfiddle.net/cHqsJ/

代码:

<div data-role="fieldcontain">
    <label for="switch">Privacy:</label>
    <select name="switch" id="switch" data-role="slider">
        <option value="0">Private</option>
        <option value="1">Public</option>
    </select>
    <a href="#switchinfo" data-role="button" data-icon="info" data-iconpos="notext" data-rel="dialog">Switch Info</a>
</div>

我需要修理什么?

1 个答案:

答案 0 :(得分:1)

使用Three-column grids。 DEMO http://jsfiddle.net/yeyene/Rdfxs/17/

        <div data-role="fieldcontain">
            <div class="ui-grid-b">
                <div class="ui-block-a"><label for="switch">Privacy:</label></div>
                <div class="ui-block-b">
                    <select name="switch" id="switch" data-role="slider">
                        <option value="0">Private</option>
                        <option value="1">Public</option>
                    </select>
                </div>
                <div class="ui-block-c">
                    <a href="#switchinfo" data-role="button" data-icon="info" data-iconpos="notext" data-rel="dialog">Switch Info</a>
                </div>
            </div><!-- /grid-b -->     
        </div>

*还有data-inline="true",但标签会破坏另一条线。

DEMO http://jsfiddle.net/yeyene/cHqsJ/1/