checkbox

Uncheck parent checkbox if one child is unchecked

泪湿孤枕 提交于 2019-12-30 11:15:20
问题 I am developing an application that requires the value of multiple checkboxes. I have nested lists containing checkboxes. The current functionality is this: When a parent is checked, all children are checked under it. When a child is checked, the parent is not selected. I need to add this functionality: When a child is unchecked after the parent is checked, the parent unchecks, but leaves the children checked. $('input[name="level-1"],input[name="level-2"]').bind('click', function () { $(

Use JQuery to check a checkbox in a parent list-item?

坚强是说给别人听的谎言 提交于 2019-12-30 09:56:22
问题 I'm brand new to Javascript and JQuery, so I've been reading up on it and am trying to check (and set inactive) a checkbox in a parent list-item when one of the children are checked. If this doesn't make any sense, take a look at the list structure. <ul> <li><input type="checkbox" name="items[]" value="88712003" id="88712003" /> Parent 1</li> <li><input type="checkbox" name="items[]" value="88712003" id="88712003" /> Parent 2 <ul> <li><input type="checkbox" name="items[]" value="21312341" id=

Javascript select Google markers for all possibilities of checkbox conditions

旧街凉风 提交于 2019-12-30 07:49:46
问题 I am placing markers on a Google map. I have a number of checkboxes (19 currently) in a form that I am trying to create a dynamic "and" condition to display or not display markers. The code works great for the individual pieces when a single checkbox is selected. I would like to have the code take into account if multiple checkboxes are selected and only display those markers that meet all conditions not just add the ones that meet the next condition. Givens: The checkbox ids are "q"+# Each

Javascript select Google markers for all possibilities of checkbox conditions

混江龙づ霸主 提交于 2019-12-30 07:49:20
问题 I am placing markers on a Google map. I have a number of checkboxes (19 currently) in a form that I am trying to create a dynamic "and" condition to display or not display markers. The code works great for the individual pieces when a single checkbox is selected. I would like to have the code take into account if multiple checkboxes are selected and only display those markers that meet all conditions not just add the ones that meet the next condition. Givens: The checkbox ids are "q"+# Each

Storing checkbox value in local storage

佐手、 提交于 2019-12-30 07:31:49
问题 I have a checkbox whose value $row['uid'] I would like to store in local storage using javascript or jquery. When the user "unchecks" the checkbox, the value should be removed from local storage This is my html: <form> Favorites <input type="checkbox" class="favorite" value="'.$row['uid'].' onclick='.fave.add();'"></form> This is what I have for the local storage in javascript at the moment. I'm not quite sure how I should add and remove the value $row['uid'] var fave = fave || {}; var data =

How do I set a unique ID for checkboxes in a multi-record Rails form?

旧时模样 提交于 2019-12-30 07:27:28
问题 I've set up a Rails form roughly following the instructions in this Railscast. Here's the code for the form: <% form_tag complete_todos_path, :method => :put do %> <ul> <div id="incomplete_todos"> <% @incomplete_todos.each do |todo| %> <%= render :partial => todo %> <% end %> </div> </ul> <%= submit_tag "Mark as completed" %> <% end %> And here's the code for the todo partial: <div class="todo"> <li> <%= check_box_tag "todo_ids[]", todo.id %> <%=h todo.name %> <%= link_to 'edit', edit_todo

How to get selected items from listbox has checkboxes in WPF?

懵懂的女人 提交于 2019-12-30 06:46:28
问题 This is the ListBox code: <ListBox x:Name="courseslistview" ItemsSource="{Binding .}" FontSize="18.667" FontFamily="Trebuchet MS" LayoutUpdated="courseslistview_LayoutUpdated"> <ListBox.ItemTemplate> <DataTemplate> <CheckBox Content="{Binding .}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> How can I use C# to get all the checked checkboxes in the above ListBox? 回答1: It would probably be best to bind the CheckBox to the IsSelected property of the ListBoxItem , like so: <DataTemplate>

Toggle checkbox on Twitter Bootstrap

倾然丶 夕夏残阳落幕 提交于 2019-12-30 04:35:07
问题 I made a group of checkboxes with Twitter Bootstrap. Now I would like to do a "select all" or "deselect all" button. How could I do this using a JS function? The Twitter Bootstrap documentation says to use $().button('toggle') but it doesn't work. Here is my code snippet: <div class="control-group"> <div class="controls"> <div class="input"> <div class="btn-group"> <label class="btn btn-toggle" for="colors-1-toggle-0"> <input type="checkbox" id="colors-1-toggle-0" name="colors-1[]" value=

How to get the values for a series of checkboxes in Laravel 4 controller (if checked)

♀尐吖头ヾ 提交于 2019-12-30 03:07:10
问题 I would like to get the values for a series of checkboxes I have set up in a Laravel 4 form. Here is the code in the view setting up the checkboxes: @foreach ($friends as $friend) <input tabindex="1" type="checkbox" name="friend[]" id="{{$friend}}" value="{{$friend}}"> @endforeach In my controller, I would like to get the values for the checked boxes and put them in an array. I am not exactly sure how to do this, but I assume it is something like: array[]; foreach($friend as $x) if (isset

How to add checkbox to material navigation drawer?

时光毁灭记忆、已成空白 提交于 2019-12-30 02:11:06
问题 I use Menu items Icon Menu but I want to add checkbox to all menu item. This is my drawer_menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="all"> <item android:checked="false" android:id="@+id/item_navigation_drawer_inbox" android:icon="@drawable/ic_inbox_black_24dp" android:checkable="true" android:title="Inbox" /> <item android:id="@+id/item_navigation_drawer_starred" android:icon="@drawable/ic