Created
December 17, 2011 02:34
-
-
Save OscarGodson/1488926 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
| /** | |
| * Converts an input type to another specified because you aren't allowed for security | |
| * reasons to change the type via JS attribute APIs. | |
| * @param {string} type The type you want to convert it to | |
| * @returns {object} A jQuery object of the new selected inputs it was replaced with | |
| */ | |
| $.fn.convertInputType = function(type){ | |
| return this.map(function(i, elem){ | |
| var clone = $( this ).clone().attr('type',type); | |
| $(this).replaceWith(clone); | |
| return clone[0]; | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment