Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#product1 :checkbox").click(function(){
- $(this)
- .closest('tr') // Find the parent row.
- .find(":input[type='text']") // Find text elements in that row.
- .attr('disabled',false).toggleClass('disabled') // Enable them.
- .end() // Go back to the row.
- .siblings() // Get its siblings
- .find(":input[type='text']") // Find text elements in those rows.
- .attr('disabled',true).removeClass('disabled'); // Disable them.
- });
- $(el).prop("disabled",!$(el).prop("disabled"))
- $(el).prop('disabled', function() { return !$(this).prop('disabled') })
- (function($) {
- $.fn.toggleDisabled = function() {
- return this.each(function() {
- var $this = $(this);
- if ($this.attr('disabled')) $this.removeAttr('disabled');
- else $this.attr('disabled', 'disabled');
- });
- };
- })(jQuery);
- (function($) {
- $.fn.toggleDisabled = function(){
- return this.each(function(){
- this.disabled = !this.disabled;
- });
- };
- })(jQuery);
- attr
- $("#product1 :checkbox").click(function(){
- $(this)
- .closest('tr') // find the parent row
- .find(":input[type='text']") // find text elements in that row
- .attr('disabled',function(idx, oldAttr) {
- return !oldAttr; // invert disabled value
- })
- .toggleClass('disabled') // enable them
- .end() // go back to the row
- .siblings() // get its siblings
- .find(":input[type='text']") // find text elements in those rows
- .attr('disabled',function(idx, oldAttr) {
- return !oldAttr; // invert disabled value
- })
- .removeClass('disabled'); // disable them
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement