Change your markup slightly:
$(function() { enable_cb(); $("#group1").click(enable_cb); }); function enable_cb() { if (this.checked) { $("input.group1").removeAttr("disabled"); } else { $("input.group1").attr("disabled", true); } }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <form name="frmChkForm" id="frmChkForm"> <input type="checkbox" name="chkcc9" id="group1">Check Me <br> <input type="checkbox" name="chk9[120]" class="group1"><br> <input type="checkbox" name="chk9[140]" class="group1"><br> <input type="checkbox" name="chk9[150]" class="group1"><br> </form>
You can do this using attribute selectors without introducing the ID and classes but it’s slower and (imho) harder to read.
Related Posts:
- What is content-type and datatype in an AJAX request?
- How to send multiple data fields via Ajax?
- Adding an onclick function to go to url in JavaScript?
- When and why to ‘return false’ in JavaScript?
- Download File Using jQuery
- Jquery Ajax Posting JSON to webservice
- correct way of comparing string jquery operator =
- Jquery to change form action
- Split string in jquery
- Detecting value change of input[type=text] in jQuery
- Javascript : array.length returns undefined
- Comparing dates in jquery
- Slide right to left?
- Is this Solution for Caches vs Cookies Going to Get Me in Trouble?
- How do I make script load after jquery?
- How to control what jQuery version to include, with wp_enqueue_script
- Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?
- Best Practices for Seperating jQuery from HTML/PHP
- Using Underscore Templates in WordPress
- Why do we include jQuery in the header?
- Passing a varible from jQuery to PHP
- Asynchronous Javascript Loaders
- Unbind postbox click handler
- This jQuery snippet doesn’t seem to work with WordPress
- Displaying custom post-types in a Fancybox div and then linking to them
- How to Use JSON With AJAX?
- WP REST return value to error function from Request
- How to Make Google Jquery Library Async or Defer?
- Hide/show customizer controls based on other settings in Customizer
- When does WordPress automatically enqueue jQuery?
- WordPress 3.6 and Accordion UI issues?
- jQuery Tree View and wp_list_pages
- Cancel jQuery ‘noConflict’ – is it really unsafe?
- WordPress Ajax not function as I expect… what’s wrong?
- Vimeo Froogaloop API, working in Fiddle but not WP
- Cannot prefill hidden Ninja Forms fields
- How to show jquery popup only in one page or once?
- jQuery Ajax returning correct Response, but after redirect to 404 Error
- How to get those data using with ajax json?
- SSL issues with WordPress site
- Blip Slideshow plugin Mootools/jQuery conflict
- How to tell WordPress that jQuery exists on the page to avoid duplicates via wp_enqueue_scripts
- Which jQuery packages are included in WordPress 3.1.2?
- Good Solution for Adding jQuery Tabs Anywhere Within WordPress?
- jQuery code not working in widgets page
- Load random posts without refreshing page (jQuery)?
- How to use jquery included with wordpress for jpanelmenu
- Cannot get Jquery to work with wordpress
- Problem getting .js file to load via a plugin
- Using jquery-1.7.2.min.js instead of the wordpress jquery
- WordPress error when replacing local jQuery by externally-hosted
- Adding jQuery UI elements to WordPress page
- Create special WordPress slideshow with “jquery.cycle.all.js”
- Jquery UI Google CSS, from where?
- datepicker for custom post type admin
- Disable Cloudflare Rocket Loader for jQuery javascript and make it load first
- How to add plugin with jQuery to custom theme?
- jQuery selectable() function won’t work in wordpress
- jQuery(selector) vs. $(selector)
- Null/undefined return in WordPress AJAX request
- Manipulate retrieved ajax data in php
- Disable auto hide of the login form on Woocommerce’s checkout page
- How do I make Contact Form 7 pop up in thickbox? [closed]
- WordPress Front-End Theme Editor
- Sorting dynamic table content with jQuery
- jQuery .load and WP function
- Bootstrap and jQuery error: $ is not defined
- Fire action after enqueue script
- Auto next upon clicking image without clicking Next button
- How can I get this menu container to be the height of the contents?
- JQuery is not working after complete load of the page
- Carousel Slider For Custom PHP Snippet Is Not Working
- why does so many javascript libraries are loaded along with my website?
- Why does my media selection script write to ONLY the first input field?
- Add a jQuery snippet for sepcific user role
- Move jQuery on *top* of footer
- How to specify url for ajax call in wordpress plugin
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Dynamic image grid gallery
- Responsive framework – edit child js
- Page keeps refreshing with Ajax form
- JS script not being included [closed]
- jquery issue in functions.php
- JS plugin script loading but not working
- WP Calendar Shortcode not working on my theme
- WooCommerce – PrettyPhoto appending URL with #prettyPhoto
- Are you sure popup on Contact Form 7 [closed]
- change the icon of a custom post type in WordPress to use twitter boostrap
- Using jQuery toggle() in WordPress post to show/hide Tweet button?
- Call a Simple JQuery from within Flash
- Ajax request with jQuery without WP_ajax
- How to fire jQuery after $(window).on(‘load’)
- JQuery WordPress gallery [closed]
- JS file not loading [closed]
- How can insert JQuery in WordPress? [closed]
- Jquery in IE, fully messed up
- Theme variation conflict with jquery select2 dropdown
- Generate dynamic ID’s for each accordion button
- Impossible to update jQuery version from 3.1.0
- Enqueued jQuery not working