modify the attribute’s value of the HTML tag dynamically:
Yes, we can modify the value of the attributes by using JavaScript.
Below is the input element whose attribute will be modified from text to password, JS code to modify the attribute value:

(input type=“text” id=“inputField”>
document.getElementById(“inputField”).attr(“type”, “password”);