Tag: checkbox

Dynamically Create Checkboxes from AJAX Response

I’m creating a website involving bootstrap and want to display a list of checkboxes (names of computers) in a modal dialog for the user to choose from. I have an AJAX call and response that is returning the information I want but I don’t know how to properly display it. Basically, each item that is […]

AngularJS display array based off checkbox selection

I have 4 check boxes, and depending on which one/pair is selected I want a specific array to be displayed on the page. I’m relatively new to angularjs so I’m not sure how to get this to work. So how do I a) check which check box is selected through angular, b) print out the […]

Prevent form submit if checkbox is unchecked

I’m using some Ajax / Javascript to prevent the form submit if an input field is empty. $(function() { var form = $(‘#contact-form-edc’); $(form).submit(function(e) { e.preventDefault(); var formData = $(form).serialize(); if (document.getElementById(“nachricht-field”).value.length < 10) { document.getElementById(‘error-nachricht’).style.display = “”; } else { $.ajax({ type: ‘POST’, url: $(form).attr(‘action’), data: formData }) .done(function(response) { document.getElementById(‘success’).style.display = “”; document.getElementById(‘error’).style.display […]

how to click a check box from its id with a certain key

I want to make a script that clicks a checkbox when I press the ‘c’ key. Can somebody show me how to do this or if it’s simple, make one?This is what I want it to do. $(“#cHideChat”).click();

Get value and text of selected checkboxes

I am trying to get an array of selected checkboxes values and text on button click <input type=”checkbox” name=”checkbox[]” value=”1″ /><label>text1</label> <input type=”checkbox” name=”checkbox[]” value=”2″ /><label>text2</label> <input type=”checkbox” name=”checkbox[]” value=”3″ /><label>text3</label> <input type=”checkbox” name=”checkbox[]” value=”4″ /><label>text4</label> I’m getting values of the checkboxes but how to get text also in array var checkboxes = document.getElementsByName(‘checkbox[]’); var […]

I need to enable form (it is disabled on page load) after checkbox checked

I need your help here cause I am not aware of javascript or jquery library and i think i definitely have to use them in my project.I have a disabled form when the page loads and I want to enable when I checked on the check box.I tried a lot but I didn’t find any […]

Replaced toggle button with a checkbox but not working

I replaced the button on the jQuery toggle code with a checkbox but cannot get it to work. Here is the HTML file where I tried to replace the button with a checkbox index.html <p> hi </p> <!–<button>Press me</button>–> <div class=”onoffswitch”> <input type=”checkbox” name=”onoffswitch” class=”onoffswitch-checkbox” id=”myonoffswitch” checked> <label class=”onoffswitch-label” for=”myonoffswitch”></label> </div> javascript $(function() { if […]

Detect checkbox has been click with JQuery?

What wrong with the my code. When I click on the checkbox, nothing happen $(document).ready(function(){ $(‘input:checkbox[name=drawingNo]’).click(function(){alert(‘I am here’);}); }); … <body> <form> <input type=”checkbox” name=”drawingNo” value=”1″> 1 <br> <input type=”checkbox” name=”drawingNo” value=”2″> 2 <br> <input type=”checkbox” name=”drawingNo” value=”3″> 3 <br> <input type=”checkbox” name=”drawingNo” value=”4″> 4 <br> </form> </body> EDIT: The above code worked fine. What […]

How to detect checkbox state in Javascript IE7

I have a simple checkbox on my website. Everytime you check and uncheck it, it shows an alert as to what the state is. This works flawlessly in FF, Chrome, and IE8. However, when I run this in IE7, no matter if the check is on or off, it always alerts “off”. It’s like IE7 […]

Create “check all” / “select all” checkbox with jQuery?

I have few checkboxes , out of which one is “Select All” and the others are some standalone’s. The requirement is that Ifthe user click on “Select All” checkbox, then all other checkboxes will be checked. If he unchecks the “Select All” checkbox , then everything will be unchecked. And if any one of the […]