如何在jquery mobile中向listview添加2个单选按钮

时间:2015-05-31 08:24:34

标签: jquery listview jquery-mobile radio-button

我想在我的simplelistview

的每一行中添加2个水平单选按钮

sample

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用绝对定位:

<ul data-role="listview" data-inset="true" class="myCustomUL">
    <li data-icon="false"> 
        <a href="#">
            Accura
        </a>
        <div class="cust-btns">
            <fieldset data-role="controlgroup" data-type="horizontal">
                <input type="radio" name="radio-choice-h-1" id="radio-choice-h-1a" value="on" checked="checked" />
                <label for="radio-choice-h-1a">One</label>
                <input type="radio" name="radio-choice-h-1" id="radio-choice-h-1b" value="off" />
                <label for="radio-choice-h-1b">Two</label>
            </fieldset>
        </div>
    </li>
</ul>

.myCustomUL li > a {
    padding-right: 139px !important;
    min-height: 40px;
}
.myCustomUL .cust-btns {
    position: absolute;
    top: 0px;
    width: 139px;
    bottom: 0px;
    right: 0px;
    left: auto;
}
  

<强> DEMO