function bangali() {
$(document).ready(function() {
$(".amtcollected").keyup(function() {
$(".amtcollected1").attr("disabled", true);
});
$(".amtcollected1").keyup(function() {
$(".amtcollected").attr("disabled", true);
});
});
}
bangali();
Asked
Active
Viewed 107 times
0
-
Share your HTML and post a problem question describing your problem and also give proper title – Satpal May 20 '15 at 09:27
-
You don't need `bangali` function. `ready` is sufficient – Tushar May 20 '15 at 09:28
-
3possible duplicate of [Disable/enable an input with jQuery?](http://stackoverflow.com/questions/1414365/disable-enable-an-input-with-jquery) – Liam May 20 '15 at 09:32
4 Answers
1
You don't pass a boolean value but the string "disabled"
.attr("disabled", "disabled");

A1rPun
- 16,287
- 7
- 57
- 90
-
3
-
Really you should use prop for disabled as it's a property not an attribute though in reality both will work. – Liam May 20 '15 at 09:31
1
find row index by
var row_index = $(this).parent('table').index();
and set disabled
$("table").eq(row_index).disabled = true;
I didn't test it

Adam Michalski
- 1,722
- 1
- 17
- 38
0
jQuery 1.6+ use prop()
$('#id').on('event_name', function() {
$("input").prop('disabled', true); //Disable input
$("input").prop('disabled', false); //Enable input
})
jQuery 1.5 and below use attr()
$('#id').on('event_name', function() {
$("input").attr('disabled','disabled'); //Disable input
$("input").removeAttr('disabled'); //Enable input
})
NOTE: Do not use .removeProp()
method to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element. Use .prop() to set these properties to false instead.

Kurenai Kunai
- 1,842
- 2
- 12
- 22