logo
down
shadow

Getting Checkbox in JavaScript or JQuery Value While OnClick


Getting Checkbox in JavaScript or JQuery Value While OnClick

By : user2953579
Date : November 21 2020, 01:01 AM
seems to work fine I had a Checkbox I need to get the value of checkbox of while checked. either in JavaScript or jquery. I have placed my ASPX Code below. that Should Work in IE, While I am trying it is Showing response as "on" rather than value. , ASP.Net CheckBox is rendered as input and label.
code :
<span class="checkboxselection">
    <input id="GridView1_CHK_STY_0" 
        type="checkbox" 
        name="GridView1$ctl02$CHK_STY" 
        onclick="javascript: SelectallColorsForStyle(this, value);" />
    <label for="GridView1_CHK_STY_0">100005</label>
</span>
<script type="text/javascript">
    function SelectallColorsForStyle(e, val) {
        var label = $(e).siblings("label");
        alert(label.text());
    }
</script>


Share : facebook icon twitter icon
jQuery checking a checkbox and triggering javascript onclick event

jQuery checking a checkbox and triggering javascript onclick event


By : Khan Rohan
Date : March 29 2020, 07:55 AM
I wish this helpful for you I'm trying to check a checkbox using jQuery and trigger the onclick event in the process. , Use .triggerHandler() instead of .trigger():
code :
$('input[name=check1]').attr('checked', true).triggerHandler('click');
$('input[name=check1]').prop('checked', true).triggerHandler('click');
$('input:checkbox').triggerHandler('click');
$('input:checkbox').bind('click my-click', function() ... ) // or ".on()" with 1.7
Get ID or value of a checkbox onclick of that checkbox in pure Javascript

Get ID or value of a checkbox onclick of that checkbox in pure Javascript


By : Sayed Hameed Ebrahim
Date : March 29 2020, 07:55 AM
like below fixes the issue When you call the script using the onclick attribute, you are calling the function yourself. So in this case, you're passing a variable called e which you've never defined.
Instead, you could pass a reference to the checkbox that you clicked:
code :
<input type="checkbox" name="checkgrp" onclick="return OptionsSelected(this)" value="2" id="eXAMPLE"><LABEL id="LeXAMPLE"></LABEL>
function OptionsSelected(me)
{
    alert(me.id);
}
Adding a Javascript onClick event to a HTML checkbox has prevented me from 'unchecking' the checkbox

Adding a Javascript onClick event to a HTML checkbox has prevented me from 'unchecking' the checkbox


By : Ifeanyichukwu
Date : March 29 2020, 07:55 AM
will be helpful for those in need You're using a single = in your if. This is setting the value to true then returning true and not "checking" if it is true and returning that.
You most likely want to use ===
code :
if (document.getElementById("checkbox").checked === true) {
    // ...
}
Jquery mobile transition checkbox select does not work second time in Jquery onclick function()?

Jquery mobile transition checkbox select does not work second time in Jquery onclick function()?


By : pacothetaco
Date : March 29 2020, 07:55 AM
like below fixes the issue I have found the Issue,It is happening because I do not write a refresh after check the checkbox it is mandatory to add refresh to check and uncheck the Mobile Checkbox through Jquery or Javascript. check below is the refresh function details
refresh()Returns: jQuery (plugin only) update the checkboxradio. If you manipulate a checkboxradio via JavaScript, you must call the refresh method on it to update the visual styling.
code :
 $(document).on("click", "a[id$='btnShowRates']", function (e) {  
   
       if ($('input[type=text][id$=rate]').val() != "") {
            var arrate = $('input[type=text][id$=rate]').val().split(',');
            var targetcheckboxes = $.map(arrate, function (i) { return document.getElementById(i) });
            $(targetcheckboxes).prop('checked', true).checkboxradio('refresh');
           
            for (var i in targetcheckboxes) {               
                setCustomChecked(true, $(document).find('input[type="checkbox"]:checked'));
            }                         
        }
   
       else { $('[id$=listRates] input[type=checkbox]').prop('checked', false).checkboxradio('refresh'); }
   
    });   
jQuery onclick bug for checkbox

jQuery onclick bug for checkbox


By : Abraham Williams
Date : March 29 2020, 07:55 AM
this will help You are always setting the checked state rather than querying it.
Use prop("checked") instead of prop("checked", true) in your conditional check as the latter will always set the checked state property to true.
Related Posts Related Posts :
  • RangeError: Maximum call stack size exceeded with array.slice
  • node rest client get with local variable
  • If condition not executes while mouse move fastly
  • Count the number of displayed elements in a HTML list
  • Locate JavaScript source code in Emacs
  • Clean, Modular Code vs MV* Frameworks
  • infinite scroll without loading image
  • Backbone: reverse collection order with comparator
  • What do printers ignore?
  • jQuery UI .tabs() Contentless tab?
  • Execute Javascript alert() after page (visually) loaded
  • JavaScript - duplicating array doesn't work
  • Excessive clickable area below image
  • JavaScript Regex: Replace |b| with <b>
  • Unexpected value change in 2D array in JavaScript
  • Function doesnt see parameter as a array of objects
  • jQuery fetch keypress event on chrome and IE
  • How to enable jquery validate localization?
  • Cassandra map collection returned by node.js Helenus looks odd
  • angular ng-repeat with multiple filter options
  • Selecting Children without ID or Class names
  • How to uncheck a group of checkboxes when another checkbox is checked
  • Is hiding content by Javascript or jQuery Worth trying
  • Load XUL resource using javascript
  • XML to HTML text area from server file system
  • set focus() on textbox on form onload
  • es lint '' is assigned a value but never used' eventhough i have used it
  • Can "name" attribute be used for custom VueJS components
  • Get innerHTML of content when it is clicked
  • HTTPS causes CSS animations to not load? Very confused
  • How to hide other div apart from touched div to the band
  • Is global variable assignment atomic on NodeJS?
  • Datepicker onchangemonthyear beforeshowday
  • trying to render html files using jade but it still adresses it as a jade
  • Google Analytics - Understanding and Dissecting the Snippet: What is | | [ ];
  • Replacing "[aA09.b]." to "[aA09.b]\n" in in JavaScript
  • Why wrap a function definition in an immediate function?
  • Enable / disable jQuery script on switching to different tab in a HTML page
  • how can find return variable value outside anonymous function in node js mysql query function
  • Converting 1 to 0001 in javascript array
  • svg viewbox should not resize the text fontSize?
  • store newline character with string in a variable
  • MP4 videos in Flowplayer does not play in Windows 7 Chrome
  • jquery focusin event not firing
  • How to debug Vue application with google chrome
  • html 5 web app cache download complete javascript alert?
  • Ember.js setupController fired only once
  • How to validate a currency input
  • How to convert my Array of data to key & value pair
  • Statistics circles in CSS
  • So I wanted to make a trig solver in javascript?
  • Showing HighCharts series name on x-axis and in legend
  • In Rails, how can we pass parameters in script?
  • Build Fails: `npm rebuild node-sass --force`
  • Angular Datepicker change dateformat
  • Trying to extract data from between two sets of characters
  • Configuring Jest in WebStorm
  • Uncaught Error: Syntax error, unrecognized expression: tr.ec_portfolio_title,
  • JQuery fading in fading out continuously
  • Unexpected end of input (Line 1) and Undefined Function?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org