All I want to do is create an input with an initialised value. Then when focused it clears the text field. however on blur and when the field is empty it should return its initialised value. It should also work with password fields. This is what i came up with its not working in ie.
Error message

$$('.default-text').each(function(item){
item.store('default-value', item.get('value'));
if(item.get('type') == 'password') {
item.store('default-type', 'password');
item.set('type', 'text');
item.addEvent('keyup',function(el){
if(item.get('value') != item.retrieve('default-value')) {
item.set('type', 'password');
}
});
}
item.addEvent('focus',function(el){
if(item.get('value') == item.retrieve('default-value')) {
item.set('value','');
}
});
item.addEvent('blur',function(){
if(item.get('value') == '') {
item.set('value', item.retrieve('default-value'));
if(item.retrieve('default-type') == 'password') {
item.set('type', 'text' );
}
}
});
});
IE has a problem with swapping
input.typeproperties.Swapping between types just does not appear work, if I remember correctly – which I think they did to save themselves some grief.
Eg, change a
textfield to afilefield has security implications,field.set("value", "c:\autoexec.bat").set("type", "file").getParent().send().change
passwordtotext, also dodgy (would reveal password in plain text). changetexttocheckbox/radiohas reflow and behaviour issues.I can continue but IE team just thought it best to not allow these and put an end to them, rather than deal with each case.
You need to rethink your logic somewhat.