Created
July 8, 2015 23:31
-
-
Save adamsilverstein/09485db84e41f27eaf13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_attribute( element, setFrom, setTo ) { | |
var val = element.val(); | |
from = 'type=\"' + setFrom + '\"', | |
to = 'type=\"' + setTo + '\"'; | |
// Workaround for element.attr('type', 'password'); doesn't work in ie8 | |
element | |
.replaceWith( | |
element = $( element.wrap( '<label></label>' ) | |
.parent('label') | |
.html() | |
.replace( from, to ) | |
) | |
.val( | |
element.data( 'pw' ) | |
) | |
) | |
.unwrap( 'label' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment