tani
tani

Reputation: 5

Checked=True on textbox textchange event in javascript

$('.LblQTY').live('blur', function () {
    var rwtr = $(this).parents('tr:first');
    rwtr.find('.LblAmount').text(parseFloat(parseFloat(rwtr.find('.LblRate').text()) * parseFloat($(this).attr('value') == '' ? '0' : $(this).attr('value'))).toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ","));
    var LblAmount = $(this).find('[id$="Grdlist"]');
    var grid = document.getElementById("<%= GridViewProducts.ClientID %>");
    for (i = 0; i <= grid.rows.length; i++) {
        if (LblAmount.val() != 0) {    
            $('[id$="ChkTaskSelect"]').attr('checked', true);   
        }
    }
});

in this i am trying to do is when text changes of particular row i want checked=true of check box

Upvotes: 0

Views: 148

Answers (1)

Barmar
Barmar

Reputation: 780798

Use .prop() to change the dynamic state of a checkbox:

$('[id$="ChkTaskSelect"]').prop('checked', true);

The attribute is used for the initial, default state, not the current state.

.prop() vs .attr()

Upvotes: 2

Related Questions