checkbox

jQuery: Disable all checkboxes apart from current one

北慕城南 提交于 2020-01-23 11:09:06
问题 I have checkboxes that need to act in a similar fashion to radio button controls. Essentially when one is checked all others need to be unchecked. How can I achieve this with as little pain as possible? So to summarise. If a checkbox is checked, all others (siblings) must then be unchecked leaving the clicked one checkstate untouched. I already know how to uncheck all checkboxes but if I did this, I would have to first store the checked state of the checkbox that was checked, then reapply it

Trigger an event when a checkbox is changed programmatically via JavaScript

别等时光非礼了梦想. 提交于 2020-01-23 07:01:06
问题 I need to know when a checkbox has been changed by Javascript using pure javascript. I have setup an 'onchange' event that successfully executes when the user changes the checkbox but this doesn't work when another JS function changes it using code like the following: document.getElementById('mycheckbox').checked = true; Is it possible to fire an event using pure JavaScript when JS either checks or unchecks a checkbox? 回答1: You can create a change event with the document.createEvent/initEvent

how to bind checkbox value from datatable in gridview

自作多情 提交于 2020-01-23 06:04:07
问题 I need to figure out how to bind a CheckBox value in a GridView, I have written CheckBox.Checked= DataBinder.Eval(Container.DataItem, "IsSubscribed") in GridView, but the CheckBox is always checked, even when IsSubscribed is false. I have bound the grid in Page_Load , before the page has posted back. Here is my code: <asp:TemplateField HeaderText="Select"> <ItemTemplate> <asp:CheckBox ID="chkIsSubscribed" runat="server" HeaderText="IsSubscribed" Checked='<%# DataBinder.Eval(Container.DataItem

How do I use React and forms to get an array of checked checkbox values?

前提是你 提交于 2020-01-22 14:44:26
问题 I am trying to build a filter for my portfolio website. Checkboxes that let you pick a technology (react, redux, jquery etc.) to display a piece of work(s) that contain(s) that/those technologies. So every time the user clicks on a box, I want to add the value (JavaScript, Redux, React etc.) to an array that I use in another function to check against my portfolio pieces and filter out what isn't there. I am finding this very difficult and I think it should be quite simple. Can someone point

jQuery sum checkbox values

南楼画角 提交于 2020-01-22 03:40:26
问题 I'd need to calculate sum of all checkboxes and update total based on selection here is html: <input type="checkbox" id="basic_single" name="basic_single" value="400"> <input type="checkbox" id="basic_double" name="basic_double" value="680"> . . . <input type="text" name="total" value="" size="30" id="total"> here is the script $('input:checkbox').change(function () { var total = 0; var basic_single = parseInt($('#basic_single:checked').val()); var basic_double = parseInt($('#basic_double

jQuery sum checkbox values

陌路散爱 提交于 2020-01-22 03:40:11
问题 I'd need to calculate sum of all checkboxes and update total based on selection here is html: <input type="checkbox" id="basic_single" name="basic_single" value="400"> <input type="checkbox" id="basic_double" name="basic_double" value="680"> . . . <input type="text" name="total" value="" size="30" id="total"> here is the script $('input:checkbox').change(function () { var total = 0; var basic_single = parseInt($('#basic_single:checked').val()); var basic_double = parseInt($('#basic_double

jQuery validation to select at least one checkbox

会有一股神秘感。 提交于 2020-01-22 03:19:08
问题 I have written following code to select multiple checkbox and also need to validate at least one checkbox is selected. In the following code data submission to database is working if I remove onsubmit="return validate_form()" . But I want to validate at least one checkbox is selected. Following is the code: <?php $link=mysql_connect("localhost","root","") or die("cant connect"); mysql_select_db("country_ajax",$link) or die("cant select db"); extract($_POST); $check_exist_qry="select * from

Tkinter checkbutton - text won't show up

試著忘記壹切 提交于 2020-01-22 02:47:28
问题 When I try to use a checkbutton it works fine but the text won't appear. I can't understand why. Below is my code from tkinter import * a = Tk() var1 = IntVar() Checkbutton(a, text="checkbutton", variable=var1, fg='blue').grid(row=0,sticky=W) a.mainloop() The checkbox appears but the text alongside does not 回答1: Try using themed tk (ttk) checkbutton widget: import tkinter as tk from tkinter import ttk a = tk.Tk() var1 = tk.IntVar() check_btn = ttk.Checkbutton(a, text="checkbutton", variable

Changing the size of a checkbox and the check mark in it

牧云@^-^@ 提交于 2020-01-21 06:55:06
问题 My application will be run on computers with touch sceens, operated by police officers while driving. I'm making all of the graphical elements larger so they can be operated by people with sausage fingers like my own and bigger. I've got a CheckBox that needs to appear on a screen. I need to scale the size of the check box and the check mark bigger. I tried editing the template for the Checkbox in Expression Blend by right-clicking and choosing Edit Tempate | Edit a Copy. I set up the copy so

Checkbox input using python mechanize

倖福魔咒の 提交于 2020-01-21 01:49:18
问题 I want to fill a form using python mechanize. form looks like: <POST https://10.20.254.39/cloud_computing/vmuser/migrate_vm/cli multipart/form-data <TextControl(vm=cli)> <TextControl(chost=10.20.14.39)> <SelectControl(dhost=[*, 28, 27])> <CheckboxControl(live=[on])> <CheckboxControl(undefinesource=[on])> <CheckboxControl(suspend=[on])> <SubmitControl(<None>=Submit) (readonly)> <HiddenControl(_formkey=85819e5a-02bb-42c8-891f-3ddac485438b) (readonly)> <HiddenControl(_formname=migrate_create)