0

jquery mobileを使用してチェックボックスのラベルの横にテキストボックスを追加するにはどうすればよいですか?1行である必要があります(チェックボックス->ラベル(チェックボックス用)->テキストボックス)

4

1 に答える 1

1

たとえば、次のように、参照要素と同じ行にラベルを追加する場合。

私の伝説[]チェックボックスラベル

を使用して、フィールドコンテナを使用してみてくださいdata-role="fieldcontain"

例えば:

<div data-role="fieldcontain">
    <fieldset data-role="controlgroup">
        <legend>Agree to the terms:</legend>
        <input type="checkbox" name="checkbox-2" id="checkbox-2" class="custom" />
        <label for="checkbox-2">I agree</label>
    </fieldset>
</div>

上記のコードはあなたに与えるでしょう:

条件に同意します:[]同意します

詳細については、オンラインドキュメントを確認してください:http: //jquerymobile.com/demos/1.1.1/docs/forms/checkboxes/


さて、1行に複数の要素(=異なる列に複数の要素)が必要な場合は、ラベルとその要素だけではありません。jQueryMobileのhttp://jquerymobile.com/demos/1.1Layout gridsを確認してください。.1 / docs / content / content-grids.html


あなたの例を考えると、上記の2つの方法を組み合わせて使用​​してみてください。したがって、次のようなことを試すことができます。

<div class="ui-grid-a">

    <!-- FIRST COLUMN -->
    <div class="ui-block-a">
        <div data-role="fieldcontain">
            <fieldset data-role="controlgroup">
                <legend>Agree to the terms:</legend>
                <input type="checkbox" name="checkbox-2" id="checkbox-2" class="custom" />
                <label for="checkbox-2">I agree</label>
            </fieldset>
        </div>
    </div>

    <!-- SECOND COLUMN -->
    <div class="ui-block-b">
        <input type="text"/>
    </div>

</div>

お役に立てれば。

于 2012-09-18T01:10:26.110 に答える