Tôi có danh sách các hộp kiểm sau đây. Cách danh sách là đầu ra nó cho phép người dùng chọn nhiều hơn một giá trị. Tuy nhiên, tôi cần người dùng chỉ được phép chọn một giá trị duy nhất từ danh sách hộp kiểm bên dưới.Hộp kiểm chuyển đổi (nhiều lựa chọn) thành nút radio hoặc hộp kiểm có lựa chọn duy nhất?
Có thể bằng cách nào đó đạt được điều này với jQuery không? Cũng có thể thay đổi danh sách thành các nút radio, chọn danh sách hoặc bất kỳ thứ gì khác có thể hữu ích.
Rất tiếc, tôi không có quyền truy cập vào chức năng tạo, vì vậy tôi không thể thay đổi đầu ra.
Cảm ơn trước
<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
Nếu bạn có thể, nút radio là con đường để đi. Không cần phải thêm mã phía máy khách phức tạp để đạt được thứ gì đó vốn có sẵn trong HTML. – dotariel
Tôi đồng ý, nhưng như tôi đã nói tôi không thể thay đổi điều này trước khi nó được xuất. – maze