replace input with javascript
<p>Hello everybody I'm trying to replace the 'text' input type to 'password' . And it works with following code :</p>

<pre><code>function replaceT(obj){
      var newO=document.createElement('input');
      newO.setAttribute('type','password');
      newO.setAttribute('name',obj.getAttribute('name'));
      obj.parentNode.replaceChild(newO,obj);
      newO.focus();
      }
</code></pre>

<p>But I want to add class of my previous input to the new input and I tried something like this :</p>

<pre><code>function replaceT(obj){
      var newO=document.createElement('input');
      newO.setAttribute('type','password');
      newO.setAttribute('className' obj.getAttribute('class'));
      newO.setAttribute('name',obj.getAttribute('name'));
      obj.parentNode.replaceChild(newO,obj);
      newO.focus();
      }
</code></pre>

<p>What am I doing wrong, or if that is not possible, how to set the new class manually .. Thank you</p>
