w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Uncheck the first checked CheckBox when count exceeds the Maxlimit
You could use push/pop instead of the counter. Using slice(0) allows you to use an array like a FIFO queue: function limitChecked(maxCount) { debugger; var ocbList = document.getElementById('cbList'); var cbArray = ocbList.getElementsByTagName('input'); var checked = []; for (var i = 0; i < cbArray.length; i++) { if (cbArray[i].checked==true) { checked.push(i); if (checked.length > maxCount) { cbArray[checked[0]].checked = false; checked = checked.slice(1); } } } }

Categories : C#

Count the checked checkboxes in xaml xamgrid checkbox column
If you are using ItemsSource property on XamGrid databinding should update source collection and you should be able simply to do: var count = rows.Where(r=>r.select).Count(); Where rows is your data collection. UPDATE 1: I don't have XamGrid but if you use standard DataGrid it would look like this: Data = new ObservableCollection<Step2Data> { new Step2Data { LayerName = "Ania"}, new Step2Data { LayerName = "Bartek", Accept = true}, new Step2Data { LayerName = "Omega"}, new Step2Data { LayerName = "Second"}, }; XAML: <DataGrid ItemsSource="{Binding Data}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="Layer name" Binding="{Binding LayerName}" /> <DataGridTextColumn

Categories : C#

jquery javascript .prop("checked") on checkbox returns undefined for checked checkbox
Per the JQuery documention you have to escape the square brackets. var $home = $("#tabs-advanced-options input[name='special\[0\]']"); //if($home.is(":checked")){ // always returns false if($home.prop("checked")){ // always returns undefined special["0"] = "Home"; } var $hidden = $("#tabs-advanced-options input[name='special\[1\]']"); //if($hidden.is(":checked")){ // always returns false if($hidden.prop("checked")){ // always returns undefined special["1"] = "isHidden"; }

Categories : Jquery

Angularjs checkbox checked by default on load and disables Select list when checked
If you use ng-model, you don't want to also use ng-checked. Instead just initialize the model variable to true. Normally you would do this in a controller that is managing your page (add one). In your fiddle I just did the initialization in an ng-init attribute for demonstration purposes. http://jsfiddle.net/UTULc/ <div ng-app=""> Send to Office: <input type="checkbox" ng-model="checked" ng-init="checked=true"><br/> <select id="transferTo" ng-disabled="checked"> <option>Tech1</option> <option>Tech2</option> </select> </div>

Categories : Angularjs

How to make check boxes checked on a Grid view when one checkbox of a row is checked?
On server side you need to change the checkbox so it has AutoPostBack="True" and add a OnCheckedChanged="CheckBoxTheory_Checked" so that the system can postback when you select it. Then you can use something along the lines of: Sub CheckBoxTheory_Checked (sender as object, e as eventargs) Dim CheckBoxTheory as CheckBox = sender Dim gvRow as GridviewRow = DirectCast(CheckBoxTheory.NamingContainer, GridviewRow) Dim CheckBoxPractical as CheckBox = gvRow.FindControl("CheckBoxPractical") If CheckBoxTheory.Checked = True Then CheckBoxPractical.Checked = True Else CheckBoxPractical.Checked = False End If End Sub This would get the sender as the checkbox, get the parent container (or NamingContainer), which would be a GridviewRow and then find the CheckB

Categories : Asp Net

How to change the background color of checkbox when it is checked and also changed to reset when it is unchecked from checked status?
If you are using jQuery, uou can try the on click event for your checkbox, like below: $(document).on('click', '#checkbox-id', function(event){ // Determine if the checkbox is checked or not $checked = $("#checkbox-id").is(':checked'); // Change background color of the parent node if($checked) $(this).parent().css("background-color","yellow"); else $(this).parent().css("background-color","white"); });

Categories : HTML

Disable/Enable plus checked/unchecked first checkbox when any other checkbox is checked/unchecked
You have to check the group of checkboxes that isn't the first checkbox: if ( $("input[name=search]:not('input[name=search]:eq(0)')").is(":checked")) { $("input[name=search]:eq(0)").prop('disabled',true); Demo: http://jsfiddle.net/rUm9j/7/

Categories : Jquery

@Html.CheckBox("IsMACUnique",new { @checked = "checked" } )
Your code seems correct. You can check followings: @Html.CheckBoxFor(model => model.IsMACUnique, new { @checked = "checked" } ) May be any jquery code prevents to it. Look for any check or checked classes in your .css files. If there is, use @Html.CheckBox("IsMACUnique", new { @class = "check" })

Categories : Asp Net Mvc

jQuery check if checkbox is checked and update the value of the texbox with the checkbox's value and uncheck if it's empty
if ($.trim($(this).val()) === '' && validateEmail($(this).val())) { $(this).attr('checked',false); alert("Email ID is invalid for the selected patient ! Example: abc@xyz.com");

Categories : Javascript

If value match then checkbox checked and update database with checkbox values on submit
Change this line : $query = mysql_query("UPDATE customer SET product_id = $products where customer_name = $cutomername"); to: $query = mysql_query("UPDATE customer SET product_id = $value where customer_name = $cutomername"); $products should be $value because you iterate and assign each element to this variable in your foreach loop.

Categories : PHP

jQuery - if checkbox 1 & checkbox 2 aren't checked - change form action
Looks like you want to use the onchange event on both checkboxes: $('#chgact,#chg_db_url').on('change', function () { if (!$('#chgact, #chg_db_url').is(':checked')) { $('#emf-form').attr('action', 'not_checked.php'); } else $('#emf-form').attr('action', 'test3.php'); }).triggerHandler('change'); //maybe you would like to trigger the event too

Categories : Jquery

Working with checkbox. Checkbox string value will transfer to edittext when checked
You could use setOnClickListener like so CheckBox chkEgg; EditText yourEditText; String yourText; public void addListenerOnChkIos() { chkEgg = (CheckBox) findViewById(R.id.checkbox1); chkEgg.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //is chkEgg checked? if (((CheckBox) v).isChecked()) { yourText = yourText + "Egg"; yourEditText.setText(yourText); } } }); } I only did it for one Hope this helps

Categories : Java

location access checkbox end activity after checkbox is checked
Defiantly you cannot close this screen because it's not in your application. Instead, you can let user close it by click on Back button and you check its status another time in onResume() method of your activity.

Categories : Android

Toggle and disable/enable one checkbox when another checkbox is checked
I'm guessing something like this should do it : $(function() { $('table').on('change', '.Re', function () { console.log(this.checked) $(this).closest('td').siblings('td').find('.Bar').prop('checked', this.checked); }); }); FIDDLE note : your checkboxes are'nt siblings, as they are nested in TD's that the change event is more appropriate for checkboxes that a delegated version of on() would be better, as live() is deprecated the checked property is what sets/unsets the checked state, not disabled ?

Categories : Jquery

JQuery is changing checkbox value but the checkbox is not displaying as checked
Almost right, just use 'checked' instead of true: $(this).find(".cbx input").attr('checked', 'checked'); Update: Alternatively, you can use this with newer JQuery versions: $(this).find(".cbx input").prop('checked', true);

Categories : Javascript

How to set checkbox by default checked in checkbox dialog
In the following: m_listview.setTitle("Layers Information").setMultiChoiceItems(layers_name, null, new DialogInterface.OnMultiChoiceClickListener() you are setting null to the array of checked positions. Create a boolean array like this: boolean[] checkedValues = new boolean[m_Renderer.m_Project.m_Layers.size()]; Set the boolean value to true for the items you want checked. For example, if you want the first item to be checked: checkedValues[0] = true; Then, replace: m_listview.setTitle("Layers Information").setMultiChoiceItems(layers_name, null, new DialogInterface.OnMultiChoiceClickListener() with: m_listview.setTitle("Layers Information").setMultiChoiceItems(layers_name, checkedValues,

Categories : Android

Echo checked if checkbox is checked
What you need is in_array(), this will check whether that value exists in the array, if your array contains the value, the function will return true and you can simply echo out the checked attribute if (in_array('YOUR_VALUE_HERE', $arr)) { echo 'checked="checked"'; } You can also make a function passing value and array as parameter and returning the value from the function.

Categories : PHP

How to get the Ids of checkbox I've checked?
function getCheckedIDs() { var elements = document.getElementsByTagName("INPUT"); var checkedArray = new Array(); for(var i=0;i<elements.length;i++) { if(elements[i].type === 'checkbox' && elements[i].checked) { checkedArray.push(elements[i].id); } } return checkedArray; } You can call this function onchange of checkboxes.

Categories : Javascript

Know which checkbox was checked
Try this Sub CommonClick Dim cb As CheckBox On Error Resume Next Set cb = ActiveSheet.Checkboxes(Application.Caller) If Err.Number <> 0 Then MsgBox "Sub not called from a CheckBox on current sheet" Exit Sub End If On Error GoTo 0 MsgBox cb.Name & " was set to " & cb.Value End Sub

Categories : Excel

How do I get my CheckBox to do something when it's checked?
Create a class for checkbox listener public class CheckBoxListener implements OnCheckedChangeListener { public CheckBoxListener() { } @Override public void onCheckedChanged(CompoundButton view, boolean isChecked) { switch(view.getId()) { case R.id.checkBox1: //do something case R.id.checkBox2: case ... } } } Then set this listener to all your checkboxes: final CheckBox cb1 = (CheckBox) findViewById(R.id.checkBox1); final CheckBox cb2 = (CheckBox) findViewById(R.id.checkBox2); final CheckBox cb3 = (CheckBox) findViewById(R.id.checkBox3); final CheckBox cb4 = (CheckBox) findViewById(R.id.checkBox4); final CheckBox cb5 = (CheckBox) findViewById(R.id.checkBox5); cb1.setOnCheckedChangeListener(new CheckBoxListene

Categories : Java

Checkbox keeps being checked, even if jQuery says it should not
If you do a removeProp("checked") rather than prop("checked", false) I think you should have more success. EDIT Just a thought, is your login form inside the element with the id index? If so will the changepage not need to be below the localstorage.removeitem?

Categories : Jquery

Trying to set default checkbox value if not checked
Could you not do something like this? $checkbox = isset($_POST['post_friend']) ? $_POST['post_friend'] : 0 ; So if the checkbox is checked, variable is 1. If not, variable assigned value of 0

Categories : PHP

See if bootstrap checkbox is checked asp.net c#
You can make beautiful checkboxes with Jquery, please check this page: ChackBox UI Jquery Anyway, this is a how: <script type="text/javascript"> $(function () { $(".btn").click(function () { //The old selected gets unselected $(".Selected").addClass("NoMore"); //This won't $(this).removeClass("NoMore"); //Because this is the one selected $(this).addClass("Selected"); //Take the tab selected $("#ValSel").val($(this).attr("id")); return false; }); }); </ script> <asp:HiddenField ID="ValSel" ClientIDMode="Static" runat="server" /> Then, from code-behind: Label1.Text = ValSel.Value; This is the style I used (but it is not importan

Categories : C#

Get checkbox is checked or not using Javascript
Added an id attribute to the element. <input type="checkbox" style="margin-left:24px" class="mydelete" name="checkAll" id="checkAll"onclick='checkedAll();' /> Javascript function checkedAll(){ if (document.getElementById('checkAll').checked) { alert("checked"); } else { alert("You didn't check it! Let me check it for you.") } } DEMO

Categories : Javascript

If one checkbox is checked, end function
A couple things: 1. The anonymous function in your example isn't closed, so the code isn't valid. 2. I had a hard time following exactly what you're trying to accomplish, but it sounds like you want to show the div if any combination of checkboxes are checked and hide it if none are checked. This will get you that result: $(document).ready(function() { $(function() { $('#PCOF, #PCTMI, #PCRM').on('click', function() { var numChecked = $('#PCOF:checked, #PCTMI:checked, #PCRM:checked').length; if (!numChecked) { $('#PCsetup:visible').slideUp('slow'); } else { $('#PCsetup').slideDown('slow'); } }); }); }); http://jsbin.com/IsutuhI/3

Categories : Javascript

How do I add a #.## value to a textbox that already has another ##.## value in it only if a checkbox is checked?
Add the click event on the checkbox then. Like this... <input type="checkbox" name="fifty" value="indoor" onclick="toggle(this);"/> And then in your script... <script> function toggle(checkbox){ var indoorCamping = 50.00; var total = 0.00; if(checkbox.checked){ total = (indoorCamping + document.getElementById('Amount').value); document.getElementById('Amount').value = total; } } </script>

Categories : Javascript

Limit to One When the Checkbox is Checked
Jquery: if($('#chkWorkerIsPrimary').is(':checked')){ //Your code } .is(':checked') if the user has checked the checkbox returns true, else return false or javascript: if ($("[name=chkWorkerIsPrimary]:checked").length == 0){ //your code }

Categories : Javascript

How to get checkbox checked value from Treeview in c#?
A simple way to get a collection of all selected TreeNodes would be: private List<TreeNode> AllCheckedNodes = new List<TreeNode>(); private void GetAllCheckedNodes() { for (int i = 0; i < TreeView1.CheckedNodes.Count; i++) { AllCheckedNodes.Add(TreeView1.CheckedNodes[i]); } }

Categories : C#

JS - Cant check if checkbox is checked
You should use the checked property and not the value property of your input fields: if (document.form1.nocase.checked) { //code here } The value attribute is string value that is sent to the server for every checked checkbox and you can specify its value in the html tag: <input type="checkbox" name="nocase" value="nocase"> The checked property gives you the desired boolean that shows whether or not the checkbox is checked.

Categories : Javascript

Get then add checkbox value into variable, if checked
jQuery(document).ready(function($) { var sum = 0; $('#pakker :checkbox').click(function() { sum = 0; $('#pakker :checkbox:checked').each(function(idx, elm) { sum += parseInt(elm.value, 10); }); $('#sum').html(sum); }); $('#pakker :checkbox[checked]').each(function(idx, elm){ sum += parseInt(elm.value, 10); }); $('#sum').html(sum); }); in HTML: <input type="checkbox" checked value="39" />test 1<br/> http://jsfiddle.net/vaKWs/6/ There you go. Please rate my answer. that would really help me!!

Categories : PHP

can't make checkbox checked
Solution 1: in public void onCheckboxClicked(View view) use boolean checked = checkBoxfriendRequests.isChecked(); even the view is Checkbox you still need to use findViewById first Solution 2: remove android:onClick="onCheckboxClicked" use setOnCheckedChangeListener checkBoxfriendRequests= (CheckBox) v.findViewById(R.id.checkBoxfriendRequests); checkBoxfriendRequests.setChecked(facePrefs.getBoolean("friendRequest", false)); checkBoxfriendRequests.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton arg0, boolean arg1) { editor.putBoolean("friendRequest", arg1); editor.commit(); } });

Categories : Java

jQuery: Uncheck other checkbox on one checked
you could use class for all your checkboxes, and do: $(".check_class").click(function() { $(".check_class").attr("checked", false); //uncheck all checkboxes $(this).attr("checked", true); //check the clicked one });

Categories : Jquery

Checkbox is not checked in DevExpress GridControl using wpf
First of all you need to correct the binding inside the CellTemplate: <CheckBox IsChecked="{Binding Path=RowData.Row.IsValid}"/> Second, your data items should implement INotifyPropertyChanged: public class ss:INotifyPropertyChanged { private bool _isValid; private string _evenOdd; public bool IsValid { get { return _isValid; } set { _isValid = value; OnPropertyChanged("IsValid"); } } public string EvenOdd { get { return _evenOdd; } set { _evenOdd = value; OnPropertyChanged("EvenOdd"); } } public event PropertyChangedEventHandler PropertyChange

Categories : Wpf

Yii framework: how to check whether checkbox is checked?
Try Using this Jquery Code as shown below $(document).ready(function(){ $("input[type=checkbox]").change(function(){ if($(this).is(":checked")){ alert("Checked"); //$(this).siblings("input[type=checkbox]").removeAttr("checked"); }else{ alert("Unchecked") } }); });

Categories : Javascript

jQuery Setting Checkbox to 'Checked'
The code you posted should work, maybe your QuoteRefresh(); method is returning false, or maybe your code handling the checked propertery isn't attached to the appropriate event that you want. Here's a JSFiddle of the prop method working. edit (with information gathered from your initial comment on this answer) If I'm understanding right, you're using the bootstrap toggle buttons component (which is represented with radio button values), and you're trying to change the actively toggled button with .prop('checked', true); but your components visual style isn't changing. This is because changing the checked property on a radio button from true to false or vice versa doesn't trigger any javascript events, which bootstrap relies on in order to update the visual state of the radio buttons.

Categories : Jquery

Insert group only if checkbox is checked
A couple things I spots that may be contributing to the issue: In your PHP you have a line that has this: //Remove non numaric characters from price(leave commas). $itemPrice = preg_replace('/[^0-9,.]/s', '', $itemPrice); I don't see where $itemPrice is defined though, should it be: $itemPrice = preg_replace('/[^0-9,.]/s', '', $fields['itemPrice']); Your issue of getting the "Warning: Invalid argument supplied for foreach() in /home..." can be solved by checking to make sure it exists and is an array beforelooping. You can use !empty() and is_array() to check. if(!empty($_POST['itemCheckBox']) and is_array($_POST['itemCheckBox'])){} Side Issue: Your IDs for the inputs are all the same, "itemCheckBox[]", "itemName[]", etc.. are the same ID used for all of them. This may cause prob

Categories : PHP

Checkbox won't return checked value in jquery
Have you tried with $("#messages_urgent").is(':checked').val(); or you can directly like $("#messages_urgent:checked").val(); and also give some value to checkbox echo "<input type="checkbox" value="my_value" id="messages_urgent"> Mark as <span class="label label-important">Urgent</span>";

Categories : Jquery

DataGridViewCheckBoxColumn - If checkBox checked issue
This code will never hit the message box code - you've created the control, added it to the table, then immediately checked them for their values, which will be not set. You need to have an event handler that catches changed values in the datagridview: private void dtg_ksluzby_CellValueChanged(object sender, DataGridViewCellEventArgs e) { // Check through the cells here (or use event args to get data) }

Categories : C#

when the checkbox is checked allow one data for dropdownlist
Using JQuery: After adding class "isPrimaryCheckbox" to the IsPrimary checkbox. $(document).ready(function() { $(".isPrimaryCheckbox").change(function() { if($(this).prop("checked")) { $(".isPrimaryCheckbox").not(this).prop("checked", false); } }); }); Every time one of the checkboxes is changed it checks if it has been checked - and if so unchecks all the others. The same basic principle could be applied in pure javascript (without jQuery), but it would be more complicated.

Categories : Javascript

Listen to bootstrap checkbox being checked
$('input#Checkbox1').change(function () { if ($('input#Checkbox1').is(':checked')) { $('input#Checkbox1').addClass('checked'); } else { $('input#Checkbox1').removeClass('checked'); } }); i solve it that way.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.