Toggle input disabled attribute using jQuery

Here is my code: $(“#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. }); How do I toggle .attr(‘disabled’,false);? … Read more

Is there a better way of writing v = (v == 0 ? 1 : 0); [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago. Improve this question I want to toggle a variable between 0 and 1. If it’s 0 I want to … Read more