$('.some_selector').attr('disabled', true);
$('#yourid').prop('disabled', true);
You can do this with jQuery's .attr
function, which will set attributes. Removing them is done via the .removeAttr
function.
//.attr()
$("element").attr("id", "newId");
$("element").attr("disabled", true);
//.removeAttr()
$("element").removeAttr("id");
$("element").removeAttr("disabled");
$('#someid').attr('disabled', 'true');
This could be more helpfull....
$("element").prop("id", "modifiedId");
//for boolean
$("element").prop("disabled", true);
//also you can remove attribute
$('#someid').removeProp('disabled');
use this code <script> $('#someid').attr('disabled,'true'); </script>
best solution: from jQuery v1.6 you can use prop() to add a property
$('#someid').prop('disabled', true);
to remove it, use removeProp()
$('#someid').removeProp('disabled');
Also note that the .removeProp() method should not be used to set these properties to false. Once a native property is removed, it cannot be added again. See .removeProp() for more information.
$('#someid').attr('disabled', 'true');
Add attribute as:
$('#Selector_id').attr('disabled',true);
Source: Stackoverflow.com