Skip to content

Instantly share code, notes, and snippets.

View runekaagaard's full-sized avatar

Rune Kaagaard runekaagaard

  • Copenhagen, Denmark
View GitHub Profile
@johnboxall
johnboxall / jquery.type.js
Created September 4, 2011 02:40
For when you _really_ wanna change the type of a input with jQuery
var rtype = /^(?:button|input)$/i;
jQuery.attrHooks.type.set = function(elem, value) {
// We can't allow the type property to be changed (since it causes problems in IE)
if (rtype.test(elem.nodeName) && elem.parentNode) {
// jQuery.error( "type property can't be changed" );
// JB: Or ... can it!?
var $el = $(elem);
var insertionFn = 'after';