Where "attributeName" is the name of the attribute which is to be removed and flag is the value which customizes the functionality of this removeAttribute() method. The flag value may be 0, 1 or 2 and it is optional. Following are the meanings of their flag's value.
Description of code :
Above lines of code describes the functionality of function removeAlignment(). It first takes the element object by using method document.getElementById(), thereafter we can apply removeAttribute() method. Here is the full example code as follows :
When you try to input some text into the text box, it doesn't allow you to input since it has read only attribute set to be true.
Click on the button "Remove readonly attribute of TextBox" to remove attribute "readonly" for the input text box.
Once the attribute "readonly" is removed we can insert text into text box.