$(document).ready(function() {
// #login-box password field
$(\'#password\').attr(\'type\', \'text\');
$(\'#passwo
This will do the trick. Although it could be improved to ignore attributes that are now irrelevant.
Plugin:
(function($){
$.fn.changeType = function(type) {
return this.each(function(i, elm) {
var newElm = $("");
for(var iAttr = 0; iAttr < elm.attributes.length; iAttr++) {
var attribute = elm.attributes[iAttr].name;
if(attribute === "type") {
continue;
}
newElm.attr(attribute, elm.attributes[iAttr].value);
}
$(elm).replaceWith(newElm);
});
};
})(jQuery);
Usage:
$(":submit").changeType("checkbox");
Fiddle:
http://jsfiddle.net/joshcomley/yX23U/