我有以下的複選框列表。列表輸出的方式允許用戶選擇多個值。但是,我需要用戶只能從下面的複選框列表中選擇一個值。將單選框中的複選框(多選)轉換爲單選按鈕或複選框?
有沒有可能以某種方式實現這與jQuery?也可以將列表更改爲單選按鈕,選擇列表或其他任何可能有幫助的內容。
不幸的是我沒有訪問生成函數,所以我不能改變輸出。
在此先感謝
<form class="ajax-form" id="user-register" method="post" accept-charset="UTF-8" action="(...)">
(...)
<div id="edit-notifications-custom-custom-berlin-wrapper" class="form-item form-option">
<label for="edit-notifications-custom-custom-berlin" class="option"><input type="checkbox" class="form-checkbox" value="1" id="edit-notifications-custom-custom-berlin" name="notifications_custom[custom_berlin]"> Berlin</label>
</div>
<div id="edit-notifications-custom-custom-hamburg-wrapper" class="form-item form-option">
<label for="edit-notifications-custom-custom-hamburg" class="option"><input type="checkbox" class="form-checkbox" value="1" id="edit-notifications-custom-custom-hamburg" name="notifications_custom[custom_hamburg]"> Hamburg</label>
</div>
<div id="edit-notifications-custom-custom-frankfurt-am-main-wrapper" class="form-item form-option">
<label for="edit-notifications-custom-custom-frankfurt-am-main" class="option"><input type="checkbox" class="form-checkbox" value="1" id="edit-notifications-custom-custom-frankfurt-am-main" name="notifications_custom[custom_frankfurt-am-main]"> Frankfurt am Main</label>
</div>
<div id="edit-notifications-custom-custom-duesseldorf-wrapper" class="form-item form-option">
<label for="edit-notifications-custom-custom-duesseldorf" class="option"><input type="checkbox" class="form-checkbox" value="1" id="edit-notifications-custom-custom-duesseldorf" name="notifications_custom[custom_duesseldorf]"> Düsseldorf</label>
</div>
<div id="edit-notifications-custom-custom-bielefeld-wrapper" class="form-item form-option">
<label for="edit-notifications-custom-custom-bielefeld" class="option"><input type="checkbox" class="form-checkbox" value="1" id="edit-notifications-custom-custom-bielefeld" name="notifications_custom[custom_bielefeld]"> Bielefeld</label>
</div>
<div id="edit-notifications-custom-custom-muenchen-wrapper" class="form-item form-option">
<label for="edit-notifications-custom-custom-muenchen" class="option"><input type="checkbox" class="form-checkbox" value="1" id="edit-notifications-custom-custom-muenchen" name="notifications_custom[custom_muenchen]"> München</label>
</div>
(...)
asdasd
如果你能,單選按鈕的路要走。無需添加複雜的客戶端代碼即可實現HTML中本地可用的功能。 – dotariel 2010-11-02 19:55:28
我同意,但正如我所說,在輸出前我無法改變它。 – maze 2010-11-02 20:13:59