skip to Main Content

How to toggle element attribute by checkbox selection jquery?

I need to toggle attribute 'disable' in button by checkbox selection? Please help $(document).ready(function() { $("#checkbox").click(function() { $(".btn-submit").attr("checked"); }) }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="checkbox" class="checkbox" id="checkbox"> <button class="btn-submit" disabled>Submit</button>

VIEW QUESTION

I am using 2 loops, 1 for input and 1 for td. Can we achieve the same functionality with 1 loop in jQuery?

$("#bodyTargets tr").filter(function(index) { const firstTdText = Number($(this).find("td:first").text()) || 0; return !(firstTdText >= (Number($txtStartMonth.val()) || 0) && firstTdText <= (Number($txtEndMonth.val()) || 0)); }).each(function(index, element) { $(this).find("input").each(function() { $(this).prop("disabled", true); $(this).css('color', 'red'); }); $(this).find("td").each(function() { $(this).css('color', 'red'); }); }); <table class="table table-borderless…

VIEW QUESTION

Jquery – Finding the properties as an object in an html web page

I have an html web page containing the following tags: <div class="user_list"> <div onclick="dropUser(2483071,'Jack','m');" class="user_item"> <div class="avatar"><img " src="..."> </div> </div> <div onclick="dropUser(2483075,'Sara','f');" class="user_item"> <div class="avatar"><img " src="..."> </div> </div> .... </div> I want to make an array of objects…

VIEW QUESTION
Back To Top
Search