javascript events - disabling the button and uncheck the checkbox using jquery -
what trying added 2 buttons disabled default.when add item buttons enable once click receipt button checkbox checked should go away working in laptop not in fiddle , if click receipt should removeattr checked check box , buttons should disable because no checkbox checked..here code jsfiddle
javascript:
// json data object var data = json.parse('{ "122233334444": ["book","three musketters","de7598490587","7584092043857", "03/18/13 11:17:51 am","03/18/13 11:17:51 am", "1" ], "122223355552":["ebook","fall colors","xyz29494949","7584092043857", "03/18/13 11:17:51 am","03/18/13 11:17:51 am", "2" ], "122223355533":["ebook","snowfall","xyz29494949","7584092043857", "03/18/13 11:17:51 am","03/18/13 11:17:51 am", "3" ] }'); $("#submitid").click(function () { $('#resend').removeattr('disabled'); $('#receipt').removeattr('disabled'); var rowid = $("#number").val(); $("#number").val(""); var rowdata = data[rowid]; if (rowdata) { var tr = $("<tr><td><input id='item-id' type='checkbox' checked/></td></tr>").attr("id", "datatable-row-" + rowid); (var col = 0; col < rowdata.length; col++) tr.append($("<td></td>").text(rowdata[col])); $("#datatable").prepend(tr); $("#datatable").show(); } else { alert("row doesn't exist in json object: " + rowid); } }); $('#receipt').click(function () { $('#item-id').removeattr('checked'); $('#resend').attr('disabled'); $('#receipt').attr('disabled'); });
first thing, don't use same id checkboxes, id attributes should unique in html page. if want uncheck checkboxes can use this:
$('#receipt').click(function(){ $(':checked').removeattr('checked'); $('#resend, #receipt').attr('disabled','disabled'); });
Comments
Post a Comment