Last active
December 25, 2015 01:19
-
-
Save mephraums/6893666 to your computer and use it in GitHub Desktop.
Revisions
-
hireSwish revised this gist
Oct 18, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ //Change Element Type plugin //Source: http://stackoverflow.com/questions/8584098/how-to-change-an-element-type-using-jquery $.fn.changeElementType = function(newType) { var newElements = []; -
hireSwish revised this gist
Oct 18, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,6 @@ $.fn.changeElementType = function(newType) { }); return $(newElements); }; //Usage: $('input[type="text"]').changeElementType('date'); -
hireSwish revised this gist
Oct 8, 2013 . No changes.There are no files selected for viewing
-
hireSwish renamed this gist
Oct 8, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
hireSwish created this gist
Oct 8, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ $.fn.changeElementType = function(newType) { var newElements = []; $(this).each(function() { var attrs = {}; $.each(this.attributes, function(idx, attr) { attrs[attr.nodeName] = attr.nodeValue; }); var newElement = $("<" + newType + "/>", attrs).append($(this).contents()); $(this).replaceWith(newElement); newElements.push(newElement); }); return $(newElements); };