Good Day
Yesterday I tried to ask a question but I think I failed to explained what is it that I clearly searching for. I want an uncheck/check all checkbox, that when clicked all the values in the selected checkboxes be stored into the database, when unchecked be removed. Currently I have the checkbox that i working only to check and uncheck but not doing anything to the database (SQL Server).
- <script type="text/javascript">
- function toggleChecked(status)
- {
- $("#checkboxes input").each(function ()
- {
- $(this).prop("checked", status);
- });
- }
- $(document).ready(function ()
- {
-
- $("#checkboxes").click(function ()
- {
- if ($("#checkboxes").length == $("#checkboxes input:checked").length)
- {
- $("#checkall").prop("checked", true);
- }
- else
- {
- $("#checkall").removeAttr("checked");
- }
- });
- $("#checkall").click(function ()
- {
- var status = $("#checkall").prop('checked');
- toggleChecked(status);
- });
- });
- </script>
- <b>
- <label>
- Check/Uncheck All
- </label>
- <label class="switch">
- <input type="checkbox" id="checkall">
- <span class="slider round">
- </span>
- </label>
- </b>
- <br />
- <div id="checkboxes" style="height: 500px;position:relative;border:1px solid darkgray">
- <div id="div2" style="max-height:100%;overflow:auto;">
- <div id="suburbsDiv"></div>
- </div>
- </div>