Button on-click is only working once

html, javascript

Solution

Try

if (inp1.type == "password") {

instead of

if (inp1.type = "password") {

Problem

I can't figure out why the OnClick event won't happen again in my code; see the jsfiddle here: http://jsfiddle.net/btcAx/2/ html: ``` <input id="LoginID" readonly="readonly" type="password" value="UserName"/> <br/> <input id="LoginPW" readonly="readonly" type="password" value="Password"/> <br/> <input onclick="change()" type="button" value=" Show/Hide Text " id="ChangeButton"/> ``` JS: ``` function change() { var inp1 = document.querySelector('#LoginID'); var inp2 = document.querySelector('#LoginPW'); if (inp1.type = "password") { inp1.type = "text"; inp2.type = "text"; } else { inp1.type = "password"; inp2.type = "password"; } } ``` It will change from password to text type, but then it won't change back...

Original source