JavaScript jquery disable textbox using checkbox (multiple textbox with checkbox) jquery disable textbox on checkbox click,jquery disable textbox by

I am trying to disable a textbox whenever a user checks the checkbox.

I've done it with a single textbox and checkbox.

I am now stuck what if user can add multiple textbox with checkbox?

here is what my output looks so far.

enter image description here

what my output has is that whenever I tick on the checkbox the disabled attr just toggles on one textbox to another.

What i want to do is that when a checkbox was checked the textbox still remains disabled until I uncheck its respective checkbox.

here is what i coded so far.

HTML

    <div id="operator_properties">
        <label for="operator_title">Operator's title:  </label> <input type="text" id="operator_title">
        <br /><br />
        <button id="append" class="btn btn-primary">Add Connectors</button>
        <br /><br />
        <div class="col-md-10">
            <div id="parent"></div>
        </div>
        <div class="clearfix"></div>
        <hr />
        <div class="col-md-12">
            <button class="btn btn-success" id="operator_btn">
                Confirm
            </button>
        </div>
        <div class="clearfix"></div>
    </div>

Jquery

$(function () {
    var count = 1;
    $('#append').click(function () {
        $('#parent').append('<div class="operator"> <div class="row"> <div class="col-md-2"><input type="text" id="input' + count + '" class="input-text" placeholder="Input' + count + ' title"><br /> <input type="checkbox" id="disableinput' + count + '" class="disable-input" /><label for="disableinput' + count + '" style="vertical-align: middle;"> &nbsp; Disable</label> </div> &nbsp <div class="col-md-3"><input type="text" id="output' + count + '" class="output-text" placeholder="Output' + count + ' title"> <a target='_blank' href="#" id="' + count + '" class="remove">Remove</a> <br /> <input type="checkbox" id="disableoutput' + count + '" class="disable-output" /><label for="disableoutput' + count + '"style="vertical-align: middle;"> &nbsp; Disable</label></div></div></div>');
        count++;
    });
});

$(document).on('click', '.remove', function () {
    $(this).closest("div.operator").remove();
});

$(document).on('change', '.disable-input', function () {
    $("#parent").find("input.input-text").attr("disabled", false);
    if ($(this).is(":checked"))
        $(this).parent().find("input.input-text").attr("disabled", true);
    //console.log('working');
});

thanks in advanced!

Answer:1

The spec says (para 5): The PendingJob records from a single Job Queue are always initiated in FIFO order. This specification does not define the order in which multiple Job Queues are ...

The spec says (para 5): The PendingJob records from a single Job Queue are always initiated in FIFO order. This specification does not define the order in which multiple Job Queues are ...

  1. promise then execution order
  2. javascript promise then execution order
  3. .the execution promise

How can I prevent the default behavior of closing the x-editable input box when the focus changed to something else?. My requirement is to keep the input box open until a click on the tick or cross ...

How can I prevent the default behavior of closing the x-editable input box when the focus changed to something else?. My requirement is to keep the input box open until a click on the tick or cross ...

I'm trying work open page home of directory partials/home using ng-view and ng-view not working with express. A new page opens with render when acess http://localhost:3000/home. All routes defined for ...

I'm trying work open page home of directory partials/home using ng-view and ng-view not working with express. A new page opens with render when acess http://localhost:3000/home. All routes defined for ...

  1. angular view child not working
  2. angular viewencapsulation not working
  3. angular ng-view not working
  4. angular ui-view not working

I'm trying to convert my date string into an array. Date string: var date = "2017,03,23"; Desired result: [2017,03,23] Here is what I tried: var new_date = date.split(','); // result: ["2017", "03"...

I'm trying to convert my date string into an array. Date string: var date = "2017,03,23"; Desired result: [2017,03,23] Here is what I tried: var new_date = date.split(','); // result: ["2017", "03"...

  1. convert date string to date
  2. convert date string to datetime python
  3. convert date string to datetime
  4. convert date string to date python
  5. convert date string to date excel
  6. convert date string to date sql
  7. convert date string to date javascript
  8. convert date string to timestamp
  9. convert date string to date object javascript
  10. convert date string to epoch python
  11. convert date string to utc
  12. convert date string to epoch
  13. convert date string to timestamp python
  14. convert date string to different format python
  15. convert date string to date object
  16. convert date string to datetime pandas
  17. convert date string to date swift
  18. convert date string to timestamp javascript
  19. convert date string to unix timestamp
  20. convert date string to long