Changing the Values of Multiple Attributes in jQuery
You can change the values of several attributes at once, then they need to be passed as an object. For example, let's say we have the following HTML code:
<input type="text" value="!!!" id="test">
In the Javascript code, we write the attributes value, id and their values as a key-value pair:
$('#test').attr({value: 'text', type: 'password'});
Now the HTML code looks like this:
<input type="password" value="text" id="test">