This function password mode set "Readonly" using Javascript function. I have used.When I try to edit password that time will show the text mode and editable otherwise that text are "Readonly".


<input type="text" id="mytextbox" value="click the button below."/>
<input type="button" value="click" onclick="changeText();"/>

function changeText(){
   var text_box = document.getElementById('mytextbox');
    if(text_box.hasAttribute('readonly')){   
        text_box.value = "This text box is editable.";
        text_box.removeAttribute('readonly');
    }else{       
        text_box.value = "This text box is read only.";
        text_box.setAttribute('readonly', 'readonly');   
    }
}

0 comments

Related Posts Plugin for WordPress, Blogger...