I have the following Mootools code, to add a value on focus/blur in a password field:
$$('#connect_login_box #password-element > input').set('value','Password').set('type', 'text').addEvents({
focus: function(){
if (this.value=='Password') this.set('type', 'password').addClass('input_active').value=''; },
blur: function(){
if (this.value=='') this.set('type', 'text').removeClass('input_active').value='Password'; }
This code does not work in IE8, and it breaks all the other JS on the page.
I am pretty sure that the error is produced when it gets to set(‘type’, ‘text’)
Any idea how can I fix this?
Thanks!
You can’t change the type of an input element once it has been set.
Remove the input element and create a new one to replace it.