$("#btn").attr("disabled", "disabled");
i have used the above line to disable the button how would i enable it .this is not working
$("#btn").removeAttr("disabled");
$("#btn").attr("disabled", "disabled");
i have used the above line to disable the button how would i enable it .this is not working
$("#btn").removeAttr("disabled");
The jQuery attr-selector actually has an overload for this, where you can pass true/false for disabled
specifically:
$('#btn').attr('disabled', true);
$('#btn').attr('disabled', false);
The code you've shown definitely works:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<a href="#" onclick="$('#btn').attr('disabled', 'disabled')">Disable button</a><br/>
<a href="#" onclick="$('#btn').removeAttr('disabled')">Enable button</a><br/>
<input type="button" id="btn" value="Some Button" />
</body>
</html>