簡體   English   中英

jQuery移動復選框和ASP .NET

[英]jquery mobile checkbox and ASP .NET

jQuery mobile,表單元素復選框存在問題。 因此,我在.cs文件中有一個代碼:

email = Request.Form["Email"];
password = Request.Form["password"];
rememberMe = Request.Form["remember_me"].AsBool();

通常,此代碼必須用表單數據填充變量,但是jquery mobile復選框的狀態不使用“選中的” HTML標記。 http://jquerymobile.com/test/docs/forms/checkboxes/index.html

它只是在標簽中更改類,例如“ ui-checkbox-off / ui-checkbox-on”。

那么,有可能沒有大量的代碼來檢查由jquery mobile創建的復選框的狀態嗎?

謝謝。

也許您可以做這樣的事情?

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

JS

$("#divCheckbox").click(function() {

    var checkbox = $(this).find("input[type='checkbox']");

    var label = $(this).find(".ui-checkbox-on");

    checkbox.prop("checked", label.length);
});

不確定100%,但至少是DOM發生了變化(請參閱http://jsfiddle.net/rcSza/4/ ),否則,您可以對隱藏字段進行操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM