As input type change using setAttribute is not supported in IE browsers because of security concerns I am following the below way
div.innerHTML = ele.outerHTML.replace('type=text' , 'type=password');
But this is not working if type="text" or type='text' because it was not replaced.. Is there any regex to match the same in generic way and replace it?
Extending from comment:
String.replacemethod supports Regex, so you can try: