0
$('.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

Santhosh
  • 8,181
  • 4
  • 29
  • 56
tani
  • 5
  • 4
  • 1
    Please don't use `.live()`. It was deprecated in jQuery 1.7, removed entirely in 1.9. Switch to `.on()`. – Barmar Dec 03 '13 at 09:14
  • can you share the generated html sample as well – Arun P Johny Dec 03 '13 at 09:17
  • @Igle: No, jQuery objects don't have a `checked` property. – Felix Kling Dec 03 '13 at 09:18
  • $('.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 tr = $(rwtr).parent().parent().parent(); //get the parent tr of the checkbox. var txtamount = $("td input[type=checkbox]", tr).get(0); txtamount.checked = true; }); this is the solution thanks to all – tani Dec 03 '13 at 11:23

1 Answers1

2

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()

Community
  • 1
  • 1
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • i am geting this error"Object doesn't support this property or method".but i want only particular checkbox of that row in which text is chenging – tani Dec 03 '13 at 10:22
  • You need to use a more specific selector, that references the element in a particular row. Since you haven't posted your HTML, we can't tell what it should be. – Barmar Dec 03 '13 at 10:24